Skip to content

Commit

Permalink
show tx count in log for span batch (ethereum-optimism#10743)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiangxu authored Jun 5, 2024
1 parent aac0480 commit bfeecbd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions op-node/rollup/derive/span_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,14 @@ func (b *SpanBatch) GetTimestamp() uint64 {
return b.Batches[0].Timestamp
}

// TxCount returns the tx count for the batch
func (b *SpanBatch) TxCount() (count uint64) {
for _, txCount := range b.blockTxCounts {
count += txCount
}
return
}

// LogContext creates a new log context that contains information of the batch
func (b *SpanBatch) LogContext(log log.Logger) log.Logger {
if len(b.Batches) == 0 {
Expand All @@ -464,6 +472,7 @@ func (b *SpanBatch) LogContext(log log.Logger) log.Logger {
"start_epoch_number", b.GetStartEpochNum(),
"end_epoch_number", b.GetBlockEpochNum(len(b.Batches)-1),
"block_count", len(b.Batches),
"txs", b.TxCount(),
)
}

Expand Down

0 comments on commit bfeecbd

Please sign in to comment.