Skip to content

Commit

Permalink
fix: nonblocking recommit
Browse files Browse the repository at this point in the history
  • Loading branch information
irrun committed Apr 26, 2024
1 parent a686b62 commit c1bfada
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions miner/bid_simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,10 @@ func (b *bidSimulator) simBid(interruptCh chan int32, bidRuntime *BidRuntime) {
if success {
bidRuntime.duration = time.Since(simStart)

if len(b.newBidCh) == 0 {
select {
case b.newBidCh <- bidRuntime.bid:
log.Debug("BidSimulator: recommit", "builder", bidRuntime.bid.Builder, "bidHash", bidRuntime.bid.Hash().Hex())
b.newBidCh <- bidRuntime.bid
default:
}
}
}(time.Now())
Expand Down Expand Up @@ -661,6 +662,13 @@ func (b *bidSimulator) simBid(interruptCh chan int32, bidRuntime *BidRuntime) {
success = true
return
}

// recommit last best bid
select {
case b.newBidCh <- bestBid.bid:
log.Debug("BidSimulator: recommit last bid", "builder", bidRuntime.bid.Builder, "bidHash", bidRuntime.bid.Hash().Hex())
default:
}
}

// reportIssue reports the issue to the mev-sentry
Expand Down

0 comments on commit c1bfada

Please sign in to comment.