Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions miner/bid_simulator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
}
}
Expand All @@ -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
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down