Skip to content

Commit

Permalink
[Bug fix] Re-prioritize commit interrupts (#1170)
Browse files Browse the repository at this point in the history
This change will check commit interrupt signal coming from other channels, e.g. newHead, reSubmit, before checking transaction level interrupt. This is to fix a corner case where an interrupt signal coming from another channel getting intercepted by transaction level interrupt, which resulted in an uncleaned state (potentially deadlock).
  • Loading branch information
cffls authored and manav2401 committed Mar 5, 2024
1 parent cb23b9b commit 199eca4
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,14 @@ func (w *worker) commitTransactions(env *environment, txs *transactionsByPriceAn

mainloop:
for {
// Check interruption signal and abort building if it's fired.
if interrupt != nil {
if signal := interrupt.Load(); signal != commitInterruptNone {
breakCause = "interrupt"
return signalToErr(signal)
}
}

if interruptCtx != nil {
if EnableMVHashMap && w.IsRunning() {
env.state.AddEmptyMVHashMap()
Expand All @@ -970,13 +978,6 @@ mainloop:
}
}

// Check interruption signal and abort building if it's fired.
if interrupt != nil {
if signal := interrupt.Load(); signal != commitInterruptNone {
breakCause = "interrupt"
return signalToErr(signal)
}
}
// If we don't have enough gas for any further transactions then we're done.
if env.gasPool.Gas() < params.TxGas {
breakCause = "Not enough gas for further transactions"
Expand Down

0 comments on commit 199eca4

Please sign in to comment.