diff --git a/miner/bid_simulator.go b/miner/bid_simulator.go index 4dadfa908d..d5c01b8dbd 100644 --- a/miner/bid_simulator.go +++ b/miner/bid_simulator.go @@ -63,7 +63,8 @@ var ( Timeout: 5 * time.Second, Transport: transport, } - errBetterBid = errors.New("simulation abort due to better bid arrived") + errBetterBid = errors.New("simulation abort due to better bid arrived") + errNoTimeLeft = errors.New("bid discarded due to lack of simulation time") ) type bidWorker interface { @@ -682,7 +683,7 @@ func (b *bidSimulator) simBid(interruptCh chan int32, bidRuntime *BidRuntime) { if err != nil { logCtx = append(logCtx, "err", err) log.Info("BidSimulator: simulation failed", logCtx...) - if !errors.Is(errBetterBid, err) { + if !errors.Is(errBetterBid, err) && !errors.Is(errNoTimeLeft, err) { go b.reportIssue(bidRuntime, err) } } @@ -694,6 +695,9 @@ func (b *bidSimulator) simBid(interruptCh chan int32, bidRuntime *BidRuntime) { b.DelBestBidToRun(parentHash, bidRuntime.bid) } + if err != nil { + return + } // only recommit last best bid when newBidCh is empty if len(b.newBidCh) > 0 { return @@ -721,7 +725,7 @@ func (b *bidSimulator) simBid(interruptCh chan int32, bidRuntime *BidRuntime) { // if the left time is not enough to do simulation, return delay := b.engine.Delay(b.chain, bidRuntime.env.header, &b.delayLeftOver) if delay == nil || *delay <= 0 { - log.Info("BidSimulator: abort commit, no time to begin simulating") + err = errNoTimeLeft return } @@ -794,7 +798,7 @@ func (b *bidSimulator) simBid(interruptCh chan int32, bidRuntime *BidRuntime) { delay = b.engine.Delay(b.chain, bidRuntime.env.header, &b.delayLeftOver) if delay != nil && *delay < 0 { bidSimTimeoutCounter.Inc(1) - log.Info("BidSimulator: fail to commit, timeout when simulating completed") + err = errNoTimeLeft return }