Skip to content

Commit

Permalink
core/txpool: notify sync waiter if txpool is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 authored and holiman committed Jan 23, 2024
1 parent 86d1778 commit 3a73fb6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/txpool/txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
for errc == nil {
// Something interesting might have happened, run a reset if there is
Expand Down

0 comments on commit 3a73fb6

Please sign in to comment.