@@ -771,8 +771,8 @@ impl<T: TransactionOrdering> TxPool<T> {
771771 }
772772
773773 /// Determines if the tx sender is delegated or has a pending delegation, and if so, ensures
774- /// they have at most one in-flight **executable** transaction, e.g. disallow stacked and
775- /// nonce-gapped transactions from the account.
774+ /// they have at most one configured amount of in-flight **executable** transactions (default at
775+ /// most one), e.g. disallow stacked and nonce-gapped transactions from the account.
776776 fn check_delegation_limit (
777777 & self ,
778778 transaction : & ValidPoolTransaction < T :: Transaction > ,
@@ -802,8 +802,17 @@ impl<T: TransactionOrdering> TxPool<T> {
802802 return Ok ( ( ) )
803803 }
804804
805- if txs_by_sender. any ( |id| id == & transaction. transaction_id ) {
806- // Transaction replacement is supported
805+ let mut count = 0 ;
806+ for id in txs_by_sender {
807+ if id == & transaction. transaction_id {
808+ // Transaction replacement is supported
809+ return Ok ( ( ) )
810+ }
811+ count += 1 ;
812+ }
813+
814+ if count < self . config . max_inflight_delegated_slot_limit {
815+ // account still has an available slot
807816 return Ok ( ( ) )
808817 }
809818
@@ -818,8 +827,9 @@ impl<T: TransactionOrdering> TxPool<T> {
818827 /// This verifies that the transaction complies with code authorization
819828 /// restrictions brought by EIP-7702 transaction type:
820829 /// 1. Any account with a deployed delegation or an in-flight authorization to deploy a
821- /// delegation will only be allowed a single transaction slot instead of the standard limit.
822- /// This is due to the possibility of the account being sweeped by an unrelated account.
830+ /// delegation will only be allowed a certain amount of transaction slots (default 1) instead
831+ /// of the standard limit. This is due to the possibility of the account being sweeped by an
832+ /// unrelated account.
823833 /// 2. In case the pool is tracking a pending / queued transaction from a specific account, at
824834 /// most one in-flight transaction is allowed; any additional delegated transactions from
825835 /// that account will be rejected.
@@ -829,12 +839,12 @@ impl<T: TransactionOrdering> TxPool<T> {
829839 on_chain_nonce : u64 ,
830840 on_chain_code_hash : Option < B256 > ,
831841 ) -> Result < ( ) , PoolError > {
832- // Allow at most one in-flight tx for delegated accounts or those with a
833- // pending authorization.
842+ // Ensure in-flight limit for delegated accounts or those with a pending authorization.
834843 self . check_delegation_limit ( transaction, on_chain_nonce, on_chain_code_hash) ?;
835844
836845 if let Some ( authority_list) = & transaction. authority_ids {
837846 for sender_id in authority_list {
847+ // Ensure authority has at most 1 inflight transaction.
838848 if self . all_transactions . txs_iter ( * sender_id) . nth ( 1 ) . is_some ( ) {
839849 return Err ( PoolError :: new (
840850 * transaction. hash ( ) ,
0 commit comments