chg : major fix

This commit is contained in:
Shivam Sharma 2022-10-13 15:36:21 +05:30
parent 6baa56bc25
commit 002717ad23

View file

@ -702,11 +702,22 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
// Generate the next state snapshot fast without tracing
msg, _ := tx.AsMessage(signer, block.BaseFee())
statedb.Prepare(tx.Hash(), i)
vmenv := vm.NewEVM(blockCtx, core.NewEVMTxContext(msg), statedb, api.backend.ChainConfig(), vm.Config{})
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.Gas())); err != nil {
failed = err
break
if stateSyncPresent && i == len(txs)-1 {
callmsg := prepareCallMessage(msg)
if _, err := statefull.ApplyBorMessage(*vmenv, callmsg); err != nil {
failed = err
break
}
} else {
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.Gas())); err != nil {
failed = err
break
}
}
// Finalize the state so any modifications are written to the trie
// Only delete empty objects if EIP158/161 (a.k.a Spurious Dragon) is in effect
statedb.Finalise(vmenv.ChainConfig().IsEIP158(block.Number()))