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:
jwasinger 2025-01-21 11:42:05 +08:00 committed by GitHub
parent 530adfc8e3
commit e25cedf16d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -224,7 +224,10 @@ func (p *TxPool) loop(head *types.Header, chain BlockChain) {
for _, subpool := range p.subpools {
subpool.Reset(oldHead, newHead)
}
resetDone <- newHead
select {
case resetDone <- newHead:
case <-p.term:
}
}(oldHead, newHead)
// If the reset operation was explicitly requested, consider it