Skip to content

Commit 3a73fb6

Browse files
rjl493456442holiman
authored andcommitted
core/txpool: notify sync waiter if txpool is closed
1 parent 86d1778 commit 3a73fb6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

core/txpool/txpool.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,13 @@ func (p *TxPool) loop(head *types.Header, chain BlockChain) {
202202
resetForced bool // Whether a forced reset was requested, only used in simulator mode
203203
resetWaiter chan error // Channel waiting on a forced reset, only used in simulator mode
204204
)
205+
// Notify the live reset waiter to not block if the txpool is closed.
206+
defer func() {
207+
if resetWaiter != nil {
208+
resetWaiter <- errors.New("pool already terminated")
209+
resetWaiter = nil
210+
}
211+
}()
205212
var errc chan error
206213
for errc == nil {
207214
// Something interesting might have happened, run a reset if there is

0 commit comments

Comments
 (0)