mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-11 17:31:35 +00:00
core/txpool/legacypool: fix validTxMeter to count transactions (#32845)
invalidTxMeter was counting txs, while validTxMeter was counting accounts. Better make the two comparable. --------- Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
11208553dd
commit
4d6d5a3abf
1 changed files with 12 additions and 5 deletions
|
|
@ -984,17 +984,24 @@ func (pool *LegacyPool) Add(txs []*types.Transaction, sync bool) []error {
|
||||||
|
|
||||||
// addTxsLocked attempts to queue a batch of transactions if they are valid.
|
// addTxsLocked attempts to queue a batch of transactions if they are valid.
|
||||||
// The transaction pool lock must be held.
|
// 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) {
|
func (pool *LegacyPool) addTxsLocked(txs []*types.Transaction) ([]error, *accountSet) {
|
||||||
dirty := newAccountSet(pool.signer)
|
var (
|
||||||
errs := make([]error, len(txs))
|
dirty = newAccountSet(pool.signer)
|
||||||
|
errs = make([]error, len(txs))
|
||||||
|
valid int64
|
||||||
|
)
|
||||||
for i, tx := range txs {
|
for i, tx := range txs {
|
||||||
replaced, err := pool.add(tx)
|
replaced, err := pool.add(tx)
|
||||||
errs[i] = err
|
errs[i] = err
|
||||||
if err == nil && !replaced {
|
if err == nil {
|
||||||
dirty.addTx(tx)
|
if !replaced {
|
||||||
|
dirty.addTx(tx)
|
||||||
|
}
|
||||||
|
valid++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
validTxMeter.Mark(int64(len(dirty.accounts)))
|
validTxMeter.Mark(valid)
|
||||||
return errs, dirty
|
return errs, dirty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue