Skip to content

Commit

Permalink
Move down creation of tracers.Context object
Browse files Browse the repository at this point in the history
  • Loading branch information
m-Peter committed Nov 8, 2024
1 parent 279c4f3 commit 0e128b5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions api/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,16 +350,6 @@ func tracerForReceipt(
config *tracers.TraceConfig,
receipt *models.Receipt,
) (*tracers.Tracer, error) {
tracerCtx := &tracers.Context{}
if receipt != nil {
tracerCtx = &tracers.Context{
BlockHash: receipt.BlockHash,
BlockNumber: receipt.BlockNumber,
TxIndex: int(receipt.TransactionIndex),
TxHash: receipt.TxHash,
}
}

if config == nil {
config = &tracers.TraceConfig{}
}
Expand All @@ -374,6 +364,16 @@ func tracerForReceipt(
}, nil
}

tracerCtx := &tracers.Context{}
if receipt != nil {
tracerCtx = &tracers.Context{
BlockHash: receipt.BlockHash,
BlockNumber: receipt.BlockNumber,
TxIndex: int(receipt.TransactionIndex),
TxHash: receipt.TxHash,
}
}

return tracers.DefaultDirectory.New(*config.Tracer, tracerCtx, config.TracerConfig)
}

Expand Down

0 comments on commit 0e128b5

Please sign in to comment.