diff options
author | Felix Lange <fjl@twurst.com> | 2015-03-17 19:16:21 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-03-17 19:16:21 +0800 |
commit | 17c5ba2b6bfaaeab423f96523b9da13a8fb3febd (patch) | |
tree | 62d690139590a6cd7eebb95f1255a858141436f1 /core/state_transition.go | |
parent | ee7202fa00198abaa423a1483468ca979ac9f3f4 (diff) | |
download | dexon-17c5ba2b6bfaaeab423f96523b9da13a8fb3febd.tar.gz dexon-17c5ba2b6bfaaeab423f96523b9da13a8fb3febd.tar.zst dexon-17c5ba2b6bfaaeab423f96523b9da13a8fb3febd.zip |
core: actually convert transaction pool
Diffstat (limited to 'core/state_transition.go')
-rw-r--r-- | core/state_transition.go | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/core/state_transition.go b/core/state_transition.go index 29de501b0..72999de7e 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -5,7 +5,6 @@ import ( "math/big" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/state" "github.com/ethereum/go-ethereum/vm" ) @@ -57,13 +56,8 @@ type Message interface { Data() []byte } -func AddressFromMessage(msg Message) []byte { - // Generate a new address - return crypto.Sha3(common.NewValue([]interface{}{msg.From(), msg.Nonce()}).Encode())[12:] -} - func MessageCreatesContract(msg Message) bool { - return len(msg.To()) == 0 + return msg.To() == nil } func MessageGasValue(msg Message) *big.Int { @@ -93,13 +87,18 @@ func (self *StateTransition) Coinbase() *state.StateObject { return self.state.GetOrNewStateObject(self.coinbase) } func (self *StateTransition) From() *state.StateObject { - return self.state.GetOrNewStateObject(self.msg.From()) + f, _ := self.msg.From() + return self.state.GetOrNewStateObject(f) } func (self *StateTransition) To() *state.StateObject { - if self.msg != nil && MessageCreatesContract(self.msg) { + if self.msg == nil { return nil } - return self.state.GetOrNewStateObject(self.msg.To()) + to := self.msg.To() + if to == nil { + return nil // contract creation + } + return self.state.GetOrNewStateObject(*to) } func (self *StateTransition) UseGas(amount *big.Int) error { |