aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-10-20 18:31:36 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-10-20 18:31:36 +0800
commit796952a49ac12caa3949587e22a7a03c30a8910c (patch)
tree59930f3d627940e1b73030ee2c5685104a04ee34 /tests
parent10ed107ba2001d1aabba3d319ba88c5ce6e8fdc0 (diff)
parentde8d5aaa92ff843e6960eb9b7bd7ec1c1ebc6608 (diff)
downloaddexon-796952a49ac12caa3949587e22a7a03c30a8910c.tar.gz
dexon-796952a49ac12caa3949587e22a7a03c30a8910c.tar.zst
dexon-796952a49ac12caa3949587e22a7a03c30a8910c.zip
Merge pull request #1758 from fjl/coinbase
core, core/state: move gas tracking out of core/state
Diffstat (limited to 'tests')
-rw-r--r--tests/state_test_util.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/state_test_util.go b/tests/state_test_util.go
index 676d9ed8c..352fe3570 100644
--- a/tests/state_test_util.go
+++ b/tests/state_test_util.go
@@ -223,7 +223,6 @@ func RunState(statedb *state.StateDB, env, tx map[string]string) ([]byte, vm.Log
price = common.Big(tx["gasPrice"])
value = common.Big(tx["value"])
nonce = common.Big(tx["nonce"]).Uint64()
- caddr = common.HexToAddress(env["currentCoinbase"])
)
var to *common.Address
@@ -235,16 +234,15 @@ func RunState(statedb *state.StateDB, env, tx map[string]string) ([]byte, vm.Log
vm.Precompiled = vm.PrecompiledContracts()
snapshot := statedb.Copy()
- coinbase := statedb.GetOrNewStateObject(caddr)
- coinbase.SetGasLimit(common.Big(env["currentGasLimit"]))
+ gaspool := new(core.GasPool).AddGas(common.Big(env["currentGasLimit"]))
key, _ := hex.DecodeString(tx["secretKey"])
addr := crypto.PubkeyToAddress(crypto.ToECDSA(key).PublicKey)
message := NewMessage(addr, to, data, value, gas, price, nonce)
vmenv := NewEnvFromMap(statedb, env, tx)
vmenv.origin = addr
- ret, _, err := core.ApplyMessage(vmenv, message, coinbase)
- if core.IsNonceErr(err) || core.IsInvalidTxErr(err) || state.IsGasLimitErr(err) {
+ ret, _, err := core.ApplyMessage(vmenv, message, gaspool)
+ if core.IsNonceErr(err) || core.IsInvalidTxErr(err) || core.IsGasLimitErr(err) {
statedb.Set(snapshot)
}
statedb.Commit()