mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 04:57:17 +00:00
Tx pool: prevent double start or stop (#744)
* use isStarted * set on stop
This commit is contained in:
parent
9da86a2737
commit
2cccf6d02c
@ -507,6 +507,9 @@ func (pool *TxPool) Stop() {
|
||||
if pool.journal != nil {
|
||||
pool.journal.close()
|
||||
}
|
||||
|
||||
pool.isStarted = false
|
||||
|
||||
log.Info("Transaction pool stopped")
|
||||
}
|
||||
|
||||
@ -1460,6 +1463,10 @@ func (pool *TxPool) RunInit() error {
|
||||
return errors.New("can't init a nil transaction pool")
|
||||
}
|
||||
|
||||
if pool.IsStarted() {
|
||||
return errors.New("transaction pool is already started")
|
||||
}
|
||||
|
||||
var err error
|
||||
for _, fn := range pool.initFns {
|
||||
if err = fn(); err != nil {
|
||||
@ -1482,6 +1489,10 @@ func (pool *TxPool) RunStop() error {
|
||||
return errors.New("can't stop a nil transaction pool")
|
||||
}
|
||||
|
||||
if !pool.IsStarted() {
|
||||
return errors.New("transaction pool is already stopped")
|
||||
}
|
||||
|
||||
var err error
|
||||
for _, fn := range pool.stopFns {
|
||||
if err = fn(); err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user