core, core/state: move gas tracking out of core/state
The amount of gas available for tx execution was tracked in the StateObject representing the coinbase account. This commit makes the gas counter a separate type in package core, which avoids unintended consequences of intertwining the counter with state logic.
This commit is contained in:
@ -850,7 +850,6 @@ func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr st
|
||||
}
|
||||
|
||||
from.SetBalance(common.MaxBig)
|
||||
from.SetGasLimit(common.MaxBig)
|
||||
|
||||
msg := callmsg{
|
||||
from: from,
|
||||
@ -874,8 +873,8 @@ func (self *XEth) Call(fromStr, toStr, valueStr, gasStr, gasPriceStr, dataStr st
|
||||
|
||||
header := self.CurrentBlock().Header()
|
||||
vmenv := core.NewEnv(statedb, self.backend.BlockChain(), msg, header)
|
||||
|
||||
res, gas, err := core.ApplyMessage(vmenv, msg, from)
|
||||
gp := new(core.GasPool).AddGas(common.MaxBig)
|
||||
res, gas, err := core.ApplyMessage(vmenv, msg, gp)
|
||||
return common.ToHex(res), gas.String(), err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user