From a9a6192e331ee5d4eedab5ccde36dcbec7b6dbba Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Tue, 7 Oct 2025 13:46:27 +0200 Subject: [PATCH 1/2] core/txpool/legacypool: fix validTxMeter to count transactions (not accounts) Signed-off-by: Csaba Kiraly --- core/txpool/legacypool/legacypool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 80a9faf23f6..1a75e7af5e1 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -965,6 +965,7 @@ func (pool *LegacyPool) Add(txs []*types.Transaction, sync bool) []error { pool.mu.Lock() newErrs, dirtyAddrs := pool.addTxsLocked(news) pool.mu.Unlock() + validTxMeter.Mark(int64(len(news))) var nilSlot = 0 for _, err := range newErrs { @@ -994,7 +995,6 @@ func (pool *LegacyPool) addTxsLocked(txs []*types.Transaction) ([]error, *accoun dirty.addTx(tx) } } - validTxMeter.Mark(int64(len(dirty.accounts))) return errs, dirty } From ad6b1069512cbb272d57f469e69d02543846d3de Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Thu, 9 Oct 2025 14:30:15 +0200 Subject: [PATCH 2/2] core/txpool/legacypool: count only valid as valid Signed-off-by: Csaba Kiraly --- core/txpool/legacypool/legacypool.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 1a75e7af5e1..e199d21c7a8 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -965,7 +965,6 @@ func (pool *LegacyPool) Add(txs []*types.Transaction, sync bool) []error { pool.mu.Lock() newErrs, dirtyAddrs := pool.addTxsLocked(news) pool.mu.Unlock() - validTxMeter.Mark(int64(len(news))) var nilSlot = 0 for _, err := range newErrs { @@ -985,16 +984,24 @@ func (pool *LegacyPool) Add(txs []*types.Transaction, sync bool) []error { // addTxsLocked attempts to queue a batch of transactions if they are valid. // The transaction pool lock must be held. +// Returns the error for each tx, and the set of accounts that might became promotable. func (pool *LegacyPool) addTxsLocked(txs []*types.Transaction) ([]error, *accountSet) { - dirty := newAccountSet(pool.signer) - errs := make([]error, len(txs)) + var ( + dirty = newAccountSet(pool.signer) + errs = make([]error, len(txs)) + valid int64 + ) for i, tx := range txs { replaced, err := pool.add(tx) errs[i] = err - if err == nil && !replaced { - dirty.addTx(tx) + if err == nil { + if !replaced { + dirty.addTx(tx) + } + valid++ } } + validTxMeter.Mark(valid) return errs, dirty }