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.
pull/30660/merge
jwasinger 1 week ago committed by GitHub
parent 530adfc8e3
commit e25cedf16d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      core/txpool/txpool.go

@ -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…
Cancel
Save