Skip to content

Commit

Permalink
Merge pull request #52 from bnb-chain/feat-packduration
Browse files Browse the repository at this point in the history
feat: logging packing duration
  • Loading branch information
unclezoro authored Oct 12, 2024
2 parents 2c306c2 + e21985a commit f19a025
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions miner/bidder.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ func (b *Bidder) bid(work *environment) {
_, err := cli.SendBid(context.Background(), bidArgs)
if err != nil {
b.deleteBestWork(work)
log.Error("Bidder: bidding failed", "err", err, "number", work.header.Number, "txcount", len(work.txs), "unrevertible", len(work.UnRevertible))
log.Error("Bidder: bidding failed", "err", err, "number", work.header.Number, "txcount", len(work.txs),
"unrevertible", len(work.UnRevertible), "packing_duration", work.duration.Milliseconds())

var bidErr rpc.Error
ok := errors.As(err, &bidErr)
Expand All @@ -290,7 +291,8 @@ func (b *Bidder) bid(work *environment) {
}

b.deleteBestWork(work)
log.Info("Bidder: bidding success", "number", work.header.Number, "txs", len(work.txs))
log.Info("Bidder: bidding success", "number", work.header.Number, "txs", len(work.txs),
"packing_duration", work.duration.Milliseconds())
}

// isBestWork returns the work is better than the current best work
Expand Down
2 changes: 2 additions & 0 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ type environment struct {

profit *big.Int // block gas fee + BNBSentToSystem
UnRevertible []common.Hash
duration time.Duration
}

// copy creates a deep copy of environment.
Expand Down Expand Up @@ -1311,6 +1312,7 @@ LOOP:
fillStart := time.Now()
err = w.fillTransactionsAndBundles(interruptCh, work, stopTimer)
fillDuration := time.Since(fillStart)
work.duration = fillDuration
switch {
case errors.Is(err, errBlockInterruptedByNewHead):
// work.discard()
Expand Down

0 comments on commit f19a025

Please sign in to comment.