fix nonce error for debug trace api (#256)

This commit is contained in:
Daniel Liu 2023-05-05 16:09:40 +08:00
parent 858bfa2b84
commit fd6cbd5df1
2 changed files with 4 additions and 0 deletions

View file

@ -726,3 +726,5 @@ func (m Message) Gas() uint64 { return m.gasLimit }
func (m Message) Nonce() uint64 { return m.nonce }
func (m Message) Data() []byte { return m.data }
func (m Message) CheckNonce() bool { return m.checkNonce }
func (m *Message) SetNonce(nonce uint64) { m.nonce = nonce }

View file

@ -471,6 +471,8 @@ func (api *PrivateDebugAPI) traceBlock(ctx context.Context, block *types.Block,
}
// Generate the next state snapshot fast without tracing
msg, _ := tx.AsMessage(signer, balacne, block.Number())
// Set nonce to fix issue #256
msg.SetNonce(statedb.GetNonce(*tx.From()))
vmctx := core.NewEVMContext(msg, block.Header(), api.eth.blockchain, nil)
vmenv := vm.NewEVM(vmctx, statedb, XDCxState, api.config, vm.Config{})