mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
eth/tracers: cache callstack frame index in OnLog
This commit is contained in:
parent
16f50285b7
commit
f229fe945b
1 changed files with 6 additions and 2 deletions
|
|
@ -246,13 +246,17 @@ func (t *callTracer) OnLog(log *types.Log) {
|
||||||
if t.interrupt.Load() {
|
if t.interrupt.Load() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cache the index of the current frame to avoid repeated calculations
|
||||||
|
lastIdx := len(t.callstack) - 1
|
||||||
|
|
||||||
l := callLog{
|
l := callLog{
|
||||||
Address: log.Address,
|
Address: log.Address,
|
||||||
Topics: log.Topics,
|
Topics: log.Topics,
|
||||||
Data: log.Data,
|
Data: log.Data,
|
||||||
Position: hexutil.Uint(len(t.callstack[len(t.callstack)-1].Calls)),
|
Position: hexutil.Uint(len(t.callstack[lastIdx].Calls)),
|
||||||
}
|
}
|
||||||
t.callstack[len(t.callstack)-1].Logs = append(t.callstack[len(t.callstack)-1].Logs, l)
|
t.callstack[lastIdx].Logs = append(t.callstack[lastIdx].Logs, l)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetResult returns the json-encoded nested list of call traces, and any
|
// GetResult returns the json-encoded nested list of call traces, and any
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue