Skip to content

Commit 2d83caf

Browse files
committed
1 parent 6d0e162 commit 2d83caf

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

core/txpool/legacypool/legacypool.go

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -629,10 +629,10 @@ func (pool *LegacyPool) validateTxBasics(tx *types.Transaction, local bool) erro
629629
opts := &txpool.ValidationOptions{
630630
Config: pool.chainconfig,
631631
Accept: 0 |
632-
1<<types.LegacyTxType |
633-
1<<types.AccessListTxType |
634-
1<<types.DynamicFeeTxType |
635-
1<<types.SetCodeTxType,
632+
1<<types.LegacyTxType |
633+
1<<types.AccessListTxType |
634+
1<<types.DynamicFeeTxType |
635+
1<<types.SetCodeTxType,
636636
MaxSize: txMaxSize,
637637
MinTip: pool.gasTip.Load(),
638638
AcceptSponsoredTx: true,
@@ -702,6 +702,17 @@ func (pool *LegacyPool) validateAuth(tx *types.Transaction) error {
702702
return ErrInflightTxLimitReached
703703
}
704704
}
705+
// Allow at most one in-flight tx for delegated accounts or those with a
706+
// pending authorization in case of sponsor tx.
707+
if tx.Type() == types.SponsoredTxType {
708+
payer, err := types.Payer(pool.signer, tx)
709+
if err != nil {
710+
return err
711+
}
712+
if pool.currentState.GetCodeHash(payer) != types.EmptyCodeHash || len(pool.all.auths[payer]) != 0 {
713+
return ErrInflightTxLimitReached
714+
}
715+
}
705716
// Authorities cannot conflict with any pending or queued transactions.
706717
if auths := tx.SetCodeAuthorities(); len(auths) > 0 {
707718
for _, auth := range auths {
@@ -1740,7 +1751,7 @@ func (pool *LegacyPool) demoteUnexecutables() {
17401751
}
17411752
}
17421753

1743-
// Clear implements txpool.SubPool, removing all tracked txs from the pool
1754+
// Clear removing all tracked txs from the pool
17441755
// and rotating the journal.
17451756
func (pool *LegacyPool) Clear() {
17461757
pool.mu.Lock()

0 commit comments

Comments
 (0)