diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 9a1093554a..41c9a2fe50 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -609,9 +609,9 @@ func (pool *LegacyPool) validateTx(tx *types.Transaction) error { return pool.validateAuth(tx) } -// limitTxFromDelegated ensures the account with either delegation or pending +// ensureDelegationLimit ensures the account with either delegation or pending // delegation can at most send one inflight **executable** transaction. -func (pool *LegacyPool) limitTxFromDelegated(tx *types.Transaction) error { +func (pool *LegacyPool) ensureDelegationLimit(tx *types.Transaction) error { from, _ := types.Sender(pool.signer, tx) // validated // Short circuit if the sender has neither delegation nor pending delegation. @@ -630,10 +630,7 @@ func (pool *LegacyPool) limitTxFromDelegated(tx *types.Transaction) error { if pending.Contains(tx.Nonce()) { return nil } - if pending.Len() >= 1 { - return ErrInflightTxLimitReached - } - return nil + return ErrInflightTxLimitReached } // validateAuth verifies that the transaction complies with code authorization @@ -641,7 +638,7 @@ func (pool *LegacyPool) limitTxFromDelegated(tx *types.Transaction) error { func (pool *LegacyPool) validateAuth(tx *types.Transaction) error { // Allow at most one in-flight tx for delegated accounts or those with a // pending authorization. - if err := pool.limitTxFromDelegated(tx); err != nil { + if err := pool.ensureDelegationLimit(tx); err != nil { return err } // Authorities cannot conflict with any pending or queued transactions.