core: transition db now also returns the required gas amount
Exposes some core methods to transition and compute new state information and adds an additional return value to the transition db method to fetch required gas for that particular message (excluding gas refunds from any SSTORE[X] = 0 and SUICIDE. Fixes #2395
This commit is contained in:
@ -674,11 +674,11 @@ func (s *PublicBlockChainAPI) doCall(args CallArgs, blockNr rpc.BlockNumber) (st
|
||||
vmenv := core.NewEnv(stateDb, s.config, s.bc, msg, block.Header(), s.config.VmConfig)
|
||||
gp := new(core.GasPool).AddGas(common.MaxBig)
|
||||
|
||||
res, gas, err := core.ApplyMessage(vmenv, msg, gp)
|
||||
res, requiredGas, _, err := core.NewStateTransition(vmenv, msg, gp).TransitionDb()
|
||||
if len(res) == 0 { // backwards compatibility
|
||||
return "0x", gas, err
|
||||
return "0x", requiredGas, err
|
||||
}
|
||||
return common.ToHex(res), gas, err
|
||||
return common.ToHex(res), requiredGas, err
|
||||
}
|
||||
|
||||
// Call executes the given transaction on the state for the given block number.
|
||||
|
Reference in New Issue
Block a user