mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
core/txpool/legacypool: address comments from marius
This commit is contained in:
parent
bdc3e5d72f
commit
1b7228f63e
1 changed files with 4 additions and 7 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue