aboutsummaryrefslogtreecommitdiffstats
path: root/core/state_transition.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-03-17 19:16:21 +0800
committerFelix Lange <fjl@twurst.com>2015-03-17 19:16:21 +0800
commit17c5ba2b6bfaaeab423f96523b9da13a8fb3febd (patch)
tree62d690139590a6cd7eebb95f1255a858141436f1 /core/state_transition.go
parentee7202fa00198abaa423a1483468ca979ac9f3f4 (diff)
downloadgo-tangerine-17c5ba2b6bfaaeab423f96523b9da13a8fb3febd.tar.gz
go-tangerine-17c5ba2b6bfaaeab423f96523b9da13a8fb3febd.tar.zst
go-tangerine-17c5ba2b6bfaaeab423f96523b9da13a8fb3febd.zip
core: actually convert transaction pool
Diffstat (limited to 'core/state_transition.go')
-rw-r--r--core/state_transition.go19
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 {