mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
core/txpool: notify sync waiter if txpool is closed
This commit is contained in:
parent
86d17787ce
commit
3a73fb6cbf
1 changed files with 7 additions and 0 deletions
|
|
@ -202,6 +202,13 @@ func (p *TxPool) loop(head *types.Header, chain BlockChain) {
|
||||||
resetForced bool // Whether a forced reset was requested, only used in simulator mode
|
resetForced bool // Whether a forced reset was requested, only used in simulator mode
|
||||||
resetWaiter chan error // Channel waiting on a forced reset, only used in simulator mode
|
resetWaiter chan error // Channel waiting on a forced reset, only used in simulator mode
|
||||||
)
|
)
|
||||||
|
// Notify the live reset waiter to not block if the txpool is closed.
|
||||||
|
defer func() {
|
||||||
|
if resetWaiter != nil {
|
||||||
|
resetWaiter <- errors.New("pool already terminated")
|
||||||
|
resetWaiter = nil
|
||||||
|
}
|
||||||
|
}()
|
||||||
var errc chan error
|
var errc chan error
|
||||||
for errc == nil {
|
for errc == nil {
|
||||||
// Something interesting might have happened, run a reset if there is
|
// Something interesting might have happened, run a reset if there is
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue