mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 13:07:17 +00:00
safe closing txpool reorgShutdownCh (#738)
* fix * linters * buffered chan to prevent blocking * create channel on start * fmt * fix
This commit is contained in:
parent
e01f936b35
commit
9d1ba168de
@ -278,7 +278,6 @@ func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, chain block
|
||||
reqPromoteCh: make(chan *accountSet),
|
||||
queueTxEventCh: make(chan *types.Transaction),
|
||||
reorgDoneCh: make(chan chan struct{}),
|
||||
reorgShutdownCh: make(chan struct{}),
|
||||
gasPrice: new(big.Int).SetUint64(config.PriceLimit),
|
||||
}
|
||||
|
||||
@ -292,6 +291,8 @@ func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, chain block
|
||||
}
|
||||
|
||||
func (pool *TxPool) Start(chain BlockChainer) error {
|
||||
pool.reorgShutdownCh = make(chan struct{}, 1)
|
||||
|
||||
pool.locals = newAccountSet(pool.signer)
|
||||
for _, addr := range pool.config.Locals {
|
||||
log.Info("Setting new local account", "address", addr)
|
||||
@ -358,7 +359,7 @@ func (pool *TxPool) loop() {
|
||||
|
||||
// System shutdown.
|
||||
case <-pool.chainHeadSub.Err():
|
||||
close(pool.reorgShutdownCh)
|
||||
common.SafeClose(pool.reorgShutdownCh)
|
||||
return
|
||||
|
||||
// Handle stats reporting ticks
|
||||
|
Loading…
Reference in New Issue
Block a user