diff options
author | obscuren <geffobscura@gmail.com> | 2014-10-02 23:03:15 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-10-02 23:03:15 +0800 |
commit | 82be3054961864dfd5bbeaec2ab961f593203dbf (patch) | |
tree | efde516d8219f253f2bc87f26ad6d4169c2dc587 /ethchain/transaction.go | |
parent | a34a971b508e1bc1fbeb3c2d02cbb8686d2491d8 (diff) | |
download | dexon-82be3054961864dfd5bbeaec2ab961f593203dbf.tar.gz dexon-82be3054961864dfd5bbeaec2ab961f593203dbf.tar.zst dexon-82be3054961864dfd5bbeaec2ab961f593203dbf.zip |
Fixed inconsistencies
Diffstat (limited to 'ethchain/transaction.go')
-rw-r--r-- | ethchain/transaction.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ethchain/transaction.go b/ethchain/transaction.go index e7e8f3a9f..ae77ee58d 100644 --- a/ethchain/transaction.go +++ b/ethchain/transaction.go @@ -6,6 +6,7 @@ import ( "math/big" "github.com/ethereum/eth-go/ethcrypto" + "github.com/ethereum/eth-go/ethstate" "github.com/ethereum/eth-go/ethutil" "github.com/obscuren/secp256k1-go" ) @@ -77,8 +78,14 @@ func (tx *Transaction) IsContract() bool { return tx.CreatesContract() } -func (tx *Transaction) CreationAddress() []byte { - return ethcrypto.Sha3Bin(ethutil.NewValue([]interface{}{tx.Sender(), tx.Nonce}).Encode())[12:] +func (tx *Transaction) CreationAddress(state *ethstate.State) []byte { + // Generate a new address + addr := ethcrypto.Sha3Bin(ethutil.NewValue([]interface{}{tx.Sender(), tx.Nonce}).Encode())[12:] + //for i := uint64(0); state.GetStateObject(addr) != nil; i++ { + // addr = ethcrypto.Sha3Bin(ethutil.NewValue([]interface{}{tx.Sender(), tx.Nonce + i}).Encode())[12:] + //} + + return addr } func (tx *Transaction) Signature(key []byte) []byte { |