mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
eth/tracers: avoid panic if nil-receipt passed to OnTxEnd
This commit is contained in:
parent
710c3f32ac
commit
3917452e20
3 changed files with 9 additions and 3 deletions
|
|
@ -275,7 +275,9 @@ func (t *jsTracer) OnTxEnd(receipt *types.Receipt, err error) {
|
|||
}
|
||||
return
|
||||
}
|
||||
if receipt != nil {
|
||||
t.ctx["gasUsed"] = t.vm.ToValue(receipt.GasUsed)
|
||||
}
|
||||
}
|
||||
|
||||
// onStart implements the Tracer interface to initialize the tracing operation.
|
||||
|
|
|
|||
|
|
@ -268,7 +268,9 @@ func (l *StructLogger) OnTxEnd(receipt *types.Receipt, err error) {
|
|||
}
|
||||
return
|
||||
}
|
||||
if receipt != nil {
|
||||
l.usedGas = receipt.GasUsed
|
||||
}
|
||||
}
|
||||
|
||||
// StructLogs returns the captured log entries.
|
||||
|
|
|
|||
|
|
@ -225,7 +225,9 @@ func (t *callTracer) OnTxEnd(receipt *types.Receipt, err error) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
if receipt != nil {
|
||||
t.callstack[0].GasUsed = receipt.GasUsed
|
||||
}
|
||||
if t.config.WithLog {
|
||||
// Logs are not emitted when the call fails
|
||||
clearFailedLogs(&t.callstack[0], false)
|
||||
|
|
|
|||
Loading…
Reference in a new issue