diff --git a/eth/tracers/native/call_flat.go b/eth/tracers/native/call_flat.go index 4f1e6e5e0a..36decb0cf7 100644 --- a/eth/tracers/native/call_flat.go +++ b/eth/tracers/native/call_flat.go @@ -224,12 +224,17 @@ func (t *flatCallTracer) OnTxEnd(receipt *types.Receipt, err error) { if t.interrupt.Load() { return } - // Always set context with receipt data. - t.ctx = &tracers.Context{ - BlockHash: receipt.BlockHash, - BlockNumber: receipt.BlockNumber, - TxHash: receipt.TxHash, - TxIndex: int(receipt.TransactionIndex), + if receipt != nil { + // Reset context with receipt data. + t.ctx = &tracers.Context{ + BlockHash: receipt.BlockHash, + BlockNumber: receipt.BlockNumber, + TxHash: receipt.TxHash, + TxIndex: int(receipt.TransactionIndex), + } + } else { + // Set to nil if receipt is nil. + t.ctx = nil } t.tracer.OnTxEnd(receipt, err) }