Skip to content

Commit

Permalink
Merge 3098aad into 65f526a
Browse files Browse the repository at this point in the history
  • Loading branch information
ucwong authored May 11, 2023
2 parents 65f526a + 3098aad commit e41256c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ctxc/tracers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ type StdTraceConfig struct {

// txTraceResult is the result of a single transaction trace.
type txTraceResult struct {
TxHash common.Hash `json:"txHash"` // transaction hash
Result interface{} `json:"result,omitempty"` // Trace results produced by the tracer
Error string `json:"error,omitempty"` // Trace failure produced by the tracer
}
Expand Down Expand Up @@ -320,13 +321,13 @@ func (api *API) traceChain(start, end *types.Block, config *TraceConfig, closed
}
res, err := api.traceTx(ctx, msg, txctx, blockCtx, task.statedb, config)
if err != nil {
task.results[i] = &txTraceResult{Error: err.Error()}
task.results[i] = &txTraceResult{TxHash: tx.Hash(), Error: err.Error()}
log.Warn("Tracing failed", "hash", tx.Hash(), "block", task.block.NumberU64(), "err", err)
break
}
// Only delete empty objects if EIP158/161 (a.k.a Spurious Dragon) is in effect
task.statedb.Finalise(api.backend.ChainConfig().IsEIP158(task.block.Number()))
task.results[i] = &txTraceResult{Result: res}
task.results[i] = &txTraceResult{TxHash: tx.Hash(), Result: res}
}
// Tracing state is used up, queue it for de-referencing
reler.add(task.release)
Expand Down Expand Up @@ -643,10 +644,10 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
}
res, err := api.traceTx(ctx, msg, txctx, blockCtx, task.statedb, config)
if err != nil {
results[task.index] = &txTraceResult{Error: err.Error()}
results[task.index] = &txTraceResult{TxHash: txs[task.index].Hash(), Error: err.Error()}
continue
}
results[task.index] = &txTraceResult{Result: res}
results[task.index] = &txTraceResult{TxHash: txs[task.index].Hash(), Result: res}
}
}()
}
Expand Down

0 comments on commit e41256c

Please sign in to comment.