From c1bfadab6c9859b2d7643ec00a33184def1b859c Mon Sep 17 00:00:00 2001 From: irrun Date: Fri, 26 Apr 2024 16:37:20 +0800 Subject: [PATCH] fix: nonblocking recommit --- miner/bid_simulator.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/miner/bid_simulator.go b/miner/bid_simulator.go index a592998b81..411c7bf71c 100644 --- a/miner/bid_simulator.go +++ b/miner/bid_simulator.go @@ -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()) @@ -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