mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 06:23:47 +00:00
[Bug fix] Re-prioritize commit interrupts (#1170)
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).
This commit is contained in:
parent
cb23b9baa3
commit
199eca46eb
1 changed files with 8 additions and 7 deletions
|
|
@ -955,6 +955,14 @@ func (w *worker) commitTransactions(env *environment, txs *transactionsByPriceAn
|
||||||
|
|
||||||
mainloop:
|
mainloop:
|
||||||
for {
|
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 interruptCtx != nil {
|
||||||
if EnableMVHashMap && w.IsRunning() {
|
if EnableMVHashMap && w.IsRunning() {
|
||||||
env.state.AddEmptyMVHashMap()
|
env.state.AddEmptyMVHashMap()
|
||||||
|
|
@ -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 we don't have enough gas for any further transactions then we're done.
|
||||||
if env.gasPool.Gas() < params.TxGas {
|
if env.gasPool.Gas() < params.TxGas {
|
||||||
breakCause = "Not enough gas for further transactions"
|
breakCause = "Not enough gas for further transactions"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue