diff options
author | obscuren <geffobscura@gmail.com> | 2014-10-16 19:40:46 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-10-16 19:40:46 +0800 |
commit | 65cdb3436e599cfff0fd91045d4c81c26a5f61c1 (patch) | |
tree | 0eeb4bb365ed8265fb50e79347133fe493e8ea22 /tests/helper | |
parent | 86f789333a7c509058412c8a7253117af74488cd (diff) | |
download | dexon-65cdb3436e599cfff0fd91045d4c81c26a5f61c1.tar.gz dexon-65cdb3436e599cfff0fd91045d4c81c26a5f61c1.tar.zst dexon-65cdb3436e599cfff0fd91045d4c81c26a5f61c1.zip |
Updated tests
Diffstat (limited to 'tests/helper')
-rw-r--r-- | tests/helper/vm.go | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/tests/helper/vm.go b/tests/helper/vm.go index 44eb8fda1..4a0d2f8b1 100644 --- a/tests/helper/vm.go +++ b/tests/helper/vm.go @@ -4,7 +4,6 @@ import ( "math/big" "github.com/ethereum/eth-go/ethstate" - "github.com/ethereum/eth-go/ethtrie" "github.com/ethereum/eth-go/ethutil" "github.com/ethereum/eth-go/ethvm" ) @@ -39,19 +38,17 @@ func NewEnvFromMap(state *ethstate.State, envValues map[string]string, exeValues return env } -func (self *Env) Origin() []byte { return self.origin } -func (self *Env) BlockNumber() *big.Int { return self.number } -func (self *Env) PrevHash() []byte { return self.parent } -func (self *Env) Coinbase() []byte { return self.coinbase } -func (self *Env) Time() int64 { return self.time } -func (self *Env) Difficulty() *big.Int { return self.difficulty } -func (self *Env) BlockHash() []byte { return nil } - -// This is likely to fail if anything ever gets looked up in the state trie :-) -func (self *Env) State() *ethstate.State { return ethstate.New(ethtrie.New(nil, "")) } +func (self *Env) Origin() []byte { return self.origin } +func (self *Env) BlockNumber() *big.Int { return self.number } +func (self *Env) PrevHash() []byte { return self.parent } +func (self *Env) Coinbase() []byte { return self.coinbase } +func (self *Env) Time() int64 { return self.time } +func (self *Env) Difficulty() *big.Int { return self.difficulty } +func (self *Env) BlockHash() []byte { return nil } +func (self *Env) State() *ethstate.State { return self.state } func RunVm(state *ethstate.State, env, exec map[string]string) ([]byte, *big.Int, error) { - caller := state.NewStateObject(ethutil.Hex2Bytes(exec["caller"])) + caller := state.GetOrNewStateObject(ethutil.Hex2Bytes(exec["caller"])) callee := state.GetStateObject(ethutil.Hex2Bytes(exec["address"])) closure := ethvm.NewClosure(nil, caller, callee, callee.Code, ethutil.Big(exec["gas"]), ethutil.Big(exec["gasPrice"])) |