diff --git a/zk/txpool/pool_zk.go b/zk/txpool/pool_zk.go index 8fd32e327d7..f53c7965c68 100644 --- a/zk/txpool/pool_zk.go +++ b/zk/txpool/pool_zk.go @@ -260,6 +260,8 @@ func (p *TxPool) MarkForDiscardFromPendingBest(txHash common.Hash) { } func (p *TxPool) StartIfNotStarted(ctx context.Context, txPoolDb kv.RoDB, coreTx kv.Tx) error { + p.lock.Lock() + defer p.lock.Unlock() if !p.started.Load() { txPoolDbTx, err := txPoolDb.BeginRo(ctx) if err != nil { @@ -270,6 +272,9 @@ func (p *TxPool) StartIfNotStarted(ctx context.Context, txPoolDb kv.RoDB, coreTx if err := p.fromDB(ctx, txPoolDbTx, coreTx); err != nil { return fmt.Errorf("loading txs from DB: %w", err) } + if p.started.CompareAndSwap(false, true) { + log.Info("[txpool] Start if not started") + } } return nil