core/txpool: terminate subpool reset goroutine if pool was closed (#31030)
if the pool terminates before `resetDone` can be read, then the go-routine will hang.
This commit is contained in:
parent
530adfc8e3
commit
e25cedf16d
|
@ -224,7 +224,10 @@ func (p *TxPool) loop(head *types.Header, chain BlockChain) {
|
||||||
for _, subpool := range p.subpools {
|
for _, subpool := range p.subpools {
|
||||||
subpool.Reset(oldHead, newHead)
|
subpool.Reset(oldHead, newHead)
|
||||||
}
|
}
|
||||||
resetDone <- newHead
|
select {
|
||||||
|
case resetDone <- newHead:
|
||||||
|
case <-p.term:
|
||||||
|
}
|
||||||
}(oldHead, newHead)
|
}(oldHead, newHead)
|
||||||
|
|
||||||
// If the reset operation was explicitly requested, consider it
|
// If the reset operation was explicitly requested, consider it
|
||||||
|
|
Loading…
Reference in New Issue