aboutsummaryrefslogtreecommitdiffstats
path: root/tests/helper
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-04 00:18:43 +0800
committerobscuren <geffobscura@gmail.com>2015-01-04 00:18:43 +0800
commitca1b2a1a91401255ab4e26cec7eb575b99ecb8da (patch)
tree87b3c8fed57f688c138288ed5d90a0a3a1e3274b /tests/helper
parent16f417f5af16de8f1c2c140f8b249bd989200bd3 (diff)
downloaddexon-ca1b2a1a91401255ab4e26cec7eb575b99ecb8da.tar
dexon-ca1b2a1a91401255ab4e26cec7eb575b99ecb8da.tar.gz
dexon-ca1b2a1a91401255ab4e26cec7eb575b99ecb8da.tar.bz2
dexon-ca1b2a1a91401255ab4e26cec7eb575b99ecb8da.tar.lz
dexon-ca1b2a1a91401255ab4e26cec7eb575b99ecb8da.tar.xz
dexon-ca1b2a1a91401255ab4e26cec7eb575b99ecb8da.tar.zst
dexon-ca1b2a1a91401255ab4e26cec7eb575b99ecb8da.zip
Changed prev_hash to block_hash, state transition now uses vm env
* PREVHASH => BLOCKHASH( N ) * State transition object uses VMEnv as it's query interface * Updated vm.Enviroment has GetHash( n ) for BLOCKHASH instruction * Added GetHash to xeth, core, utils & test environments
Diffstat (limited to 'tests/helper')
-rw-r--r--tests/helper/vm.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/helper/vm.go b/tests/helper/vm.go
index aa17313b7..123003faa 100644
--- a/tests/helper/vm.go
+++ b/tests/helper/vm.go
@@ -55,9 +55,11 @@ 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() *state.StateDB { return self.state }
func (self *Env) GasLimit() *big.Int { return self.gasLimit }
+func (self *Env) GetHash(n uint64) []byte {
+ return nil
+}
func (self *Env) AddLog(log state.Log) {
self.logs = append(self.logs, log)
}
@@ -126,10 +128,9 @@ func RunState(statedb *state.StateDB, env, tx map[string]string) ([]byte, state.
message := NewMessage(keyPair.Address(), to, data, value, gas, price)
Log.DebugDetailf("message{ to: %x, from %x, value: %v, gas: %v, price: %v }\n", message.to[:4], message.from[:4], message.value, message.gas, message.price)
- st := core.NewStateTransition(coinbase, message, statedb, nil)
vmenv := NewEnvFromMap(statedb, env, tx)
+ st := core.NewStateTransition(vmenv, message, coinbase)
vmenv.origin = keyPair.Address()
- st.Env = vmenv
ret, err := st.TransitionState()
statedb.Update(vmenv.Gas)