Merge pull request #7 from SatpalSandhu61/geth-upgrade-1.8.12-fix-for-large-gas-estimate

Geth upgrade 1.8.12 fix for large gas estimate
This commit is contained in:
amalraj 2018-11-01 16:46:16 +08:00 committed by GitHub
commit f02d8d642d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 3 deletions

View File

@ -142,14 +142,24 @@ func (b *EthAPIBackend) GetTd(blockHash common.Hash) *big.Int {
return b.eth.blockchain.GetTdByHash(blockHash) return b.eth.blockchain.GetTdByHash(blockHash)
} }
func (b *EthAPIBackend) GetEVM(ctx context.Context, msg core.Message, state vm.MinimalApiState, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error) { func (b *EthAPIBackend) GetEVM(ctx context.Context, msg core.Message, apiState vm.MinimalApiState, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error) {
statedb := state.(EthAPIState) statedb := apiState.(EthAPIState)
// Need to ensure private state is initialised (similar to state_processor.go), else we get issues
// further down the line when checking for calls from private state to public state.
var privateState *state.StateDB
if msg, ok := msg.(core.PrivateMessage); ok && b.ChainConfig().IsQuorum && msg.IsPrivate() {
privateState = statedb.privateState
} else {
privateState = statedb.state
}
from := statedb.state.GetOrNewStateObject(msg.From()) from := statedb.state.GetOrNewStateObject(msg.From())
from.SetBalance(math.MaxBig256) from.SetBalance(math.MaxBig256)
vmError := func() error { return nil } vmError := func() error { return nil }
context := core.NewEVMContext(msg, header, b.eth.BlockChain(), nil) context := core.NewEVMContext(msg, header, b.eth.BlockChain(), nil)
return vm.NewEVM(context, statedb.state, statedb.privateState, b.eth.chainConfig, vmCfg), vmError, nil return vm.NewEVM(context, statedb.state, privateState, b.eth.chainConfig, vmCfg), vmError, nil
} }
func (b *EthAPIBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription { func (b *EthAPIBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription {