From 03206065eb44d7d4b51522fcc9cc616ad226ef80 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Sat, 18 Jan 2025 09:20:11 +0700 Subject: [PATCH 1/3] save --- txnprovider/txpool/pool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/txnprovider/txpool/pool.go b/txnprovider/txpool/pool.go index b0546d5c2c2..f6fe4886f04 100644 --- a/txnprovider/txpool/pool.go +++ b/txnprovider/txpool/pool.go @@ -307,7 +307,6 @@ func (p *TxPool) OnNewBlock(ctx context.Context, stateChanges *remote.StateChang block := stateChanges.ChangeBatch[len(stateChanges.ChangeBatch)-1].BlockHeight baseFee := stateChanges.PendingBlockBaseFee - available := len(p.pending.best.ms) if err = minedTxns.Valid(); err != nil { return err @@ -329,6 +328,7 @@ func (p *TxPool) OnNewBlock(ctx context.Context, stateChanges *remote.StateChang }() defer func() { + available := len(p.pending.best.ms) p.logger.Debug("[txpool] New block", "block", block, "unwound", len(unwindTxns.Txns), "mined", len(minedTxns.Txns), "baseFee", baseFee, "pending-pre", available, "pending", p.pending.Len(), "baseFee", p.baseFee.Len(), "queued", p.queued.Len(), "err", err) }() From c6c022d3ba9df891002d89e31246bc2772726160 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Sat, 18 Jan 2025 09:22:17 +0700 Subject: [PATCH 2/3] save --- txnprovider/txpool/pool.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/txnprovider/txpool/pool.go b/txnprovider/txpool/pool.go index f6fe4886f04..f927a627d72 100644 --- a/txnprovider/txpool/pool.go +++ b/txnprovider/txpool/pool.go @@ -273,7 +273,7 @@ func (p *TxPool) start(ctx context.Context) error { } return p.poolDB.View(ctx, func(tx kv.Tx) error { - coreDb, _ := p.coreDBWithCache() + coreDb, _ := p.chainDB() coreTx, err := coreDb.BeginRo(ctx) if err != nil { return err @@ -296,7 +296,7 @@ func (p *TxPool) start(ctx context.Context) error { func (p *TxPool) OnNewBlock(ctx context.Context, stateChanges *remote.StateChangeBatch, unwindTxns, unwindBlobTxns, minedTxns TxnSlots) error { defer newBlockTimer.ObserveDuration(time.Now()) - coreDB, cache := p.coreDBWithCache() + coreDB, cache := p.chainDB() cache.OnNewBlock(stateChanges) coreTx, err := coreDB.BeginRo(ctx) if err != nil { @@ -479,7 +479,7 @@ func (p *TxPool) processRemoteTxns(ctx context.Context) (err error) { } defer processBatchTxnsTimer.ObserveDuration(time.Now()) - coreDB, cache := p.coreDBWithCache() + coreDB, cache := p.chainDB() coreTx, err := coreDB.BeginRo(ctx) if err != nil { return err @@ -1209,7 +1209,7 @@ func fillDiscardReasons(reasons []txpoolcfg.DiscardReason, newTxns TxnSlots, dis } func (p *TxPool) AddLocalTxns(ctx context.Context, newTxns TxnSlots) ([]txpoolcfg.DiscardReason, error) { - coreDb, cache := p.coreDBWithCache() + coreDb, cache := p.chainDB() coreTx, err := coreDb.BeginRo(ctx) if err != nil { return nil, err @@ -1266,7 +1266,7 @@ func (p *TxPool) AddLocalTxns(ctx context.Context, newTxns TxnSlots) ([]txpoolcf return reasons, nil } -func (p *TxPool) coreDBWithCache() (kv.RoDB, kvcache.Cache) { +func (p *TxPool) chainDB() (kv.RoDB, kvcache.Cache) { p.lock.Lock() defer p.lock.Unlock() return p._chainDB, p._stateCache From f89651b584c001cb5ad53deeda8c6629addad787 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Sat, 18 Jan 2025 09:23:06 +0700 Subject: [PATCH 3/3] save --- txnprovider/txpool/pool.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/txnprovider/txpool/pool.go b/txnprovider/txpool/pool.go index f927a627d72..b6d6b5317b9 100644 --- a/txnprovider/txpool/pool.go +++ b/txnprovider/txpool/pool.go @@ -162,7 +162,7 @@ func New( ctx context.Context, newTxns chan Announcements, poolDB kv.RwDB, - coreDB kv.RoDB, + chainDB kv.RoDB, cfg txpoolcfg.Config, cache kvcache.Cache, chainID uint256.Int, @@ -217,7 +217,7 @@ func New( _stateCache: cache, senders: newSendersBatch(tracedSenders), poolDB: poolDB, - _chainDB: coreDB, + _chainDB: chainDB, cfg: cfg, chainID: chainID, unprocessedRemoteTxns: &TxnSlots{},