From bc251eb11c902bd13a31300a733e1e9a86890708 Mon Sep 17 00:00:00 2001 From: Daniel Katzan Date: Thu, 1 Jun 2023 16:52:45 +0300 Subject: [PATCH 1/2] core/txpool: fix isGapped implementation --- core/txpool/txpool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index cbb8cc287a0..93fbfd41157 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -826,7 +826,7 @@ 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. 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 From 910431b5723a86ae2ee2af0a82620d43405bf888 Mon Sep 17 00:00:00 2001 From: Daniel Katzan Date: Mon, 5 Jun 2023 12:07:05 +0300 Subject: [PATCH 2/2] core/txpool: update isGapped comment --- core/txpool/txpool.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/txpool/txpool.go b/core/txpool/txpool.go index 93fbfd41157..ba71dfa88a2 100644 --- a/core/txpool/txpool.go +++ b/core/txpool/txpool.go @@ -823,8 +823,10 @@ 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 { return false