core/txpool: fix isGapped implementation #27404 (#1864)

This commit is contained in:
Daniel Liu 2025-12-18 17:15:50 +08:00 committed by GitHub
parent 503d51945b
commit d976cc65d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -919,10 +919,12 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (replaced bool, err e
// isGapped reports whether the given transaction is immediately executable.
func (pool *TxPool) isGapped(from common.Address, tx *types.Transaction) bool {
// Short circuit if transaction matches pending nonce and can be promoted
// to pending list as an executable transaction.
// Short circuit if transaction falls within the scope of the pending list
// or matches the next pending nonce which can be promoted as an executable
// transaction afterwards. Note, the tx staleness is already checked in
// 'validateTx' function previously.
next := pool.pendingNonces.get(from)
if tx.Nonce() == next {
if tx.Nonce() <= next {
return false
}
// The transaction has a nonce gap with pending list, it's only considered