From e6c0f1839ba860750eea4156fc76038061a243cd Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Thu, 5 Dec 2024 21:03:51 +0400 Subject: [PATCH] rm collect --- crates/net/network/src/transactions/mod.rs | 20 ++++++-------------- crates/transaction-pool/src/lib.rs | 3 +-- crates/transaction-pool/src/noop.rs | 2 +- crates/transaction-pool/src/pool/mod.rs | 4 ++-- crates/transaction-pool/src/traits.rs | 2 +- 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/crates/net/network/src/transactions/mod.rs b/crates/net/network/src/transactions/mod.rs index 9441b54a509b..fefff2bac358 100644 --- a/crates/net/network/src/transactions/mod.rs +++ b/crates/net/network/src/transactions/mod.rs @@ -987,20 +987,12 @@ where let _ = response.send(Ok(PooledTransactions::default())); return } - let transactions = self - .pool - .get_pooled_transaction_elements( - request.0, - GetPooledTransactionLimit::ResponseSizeSoftLimit( - self.transaction_fetcher - .info - .soft_limit_byte_size_pooled_transactions_response, - ), - ) - .into_iter() - .map(|tx| tx.into_signed()) - .collect::>(); - + let transactions = self.pool.get_pooled_transaction_elements( + request.0, + GetPooledTransactionLimit::ResponseSizeSoftLimit( + self.transaction_fetcher.info.soft_limit_byte_size_pooled_transactions_response, + ), + ); trace!(target: "net::tx::propagation", sent_txs=?transactions.iter().map(|tx| tx.tx_hash()), "Sending requested transactions to peer"); // we sent a response at which point we assume that the peer is aware of the diff --git a/crates/transaction-pool/src/lib.rs b/crates/transaction-pool/src/lib.rs index 523e3961993f..0e069291e735 100644 --- a/crates/transaction-pool/src/lib.rs +++ b/crates/transaction-pool/src/lib.rs @@ -416,8 +416,7 @@ where &self, tx_hashes: Vec, limit: GetPooledTransactionLimit, - ) -> Vec::Transaction as PoolTransaction>::Pooled>> - { + ) -> Vec<<::Transaction as PoolTransaction>::Pooled> { self.pool.get_pooled_transaction_elements(tx_hashes, limit) } diff --git a/crates/transaction-pool/src/noop.rs b/crates/transaction-pool/src/noop.rs index 6e675386ec05..8d880994aa9e 100644 --- a/crates/transaction-pool/src/noop.rs +++ b/crates/transaction-pool/src/noop.rs @@ -136,7 +136,7 @@ impl TransactionPool for NoopTransactionPool { &self, _tx_hashes: Vec, _limit: GetPooledTransactionLimit, - ) -> Vec::Pooled>> { + ) -> Vec<::Pooled> { vec![] } diff --git a/crates/transaction-pool/src/pool/mod.rs b/crates/transaction-pool/src/pool/mod.rs index 79b09d6eb6af..044b192fe590 100644 --- a/crates/transaction-pool/src/pool/mod.rs +++ b/crates/transaction-pool/src/pool/mod.rs @@ -340,7 +340,7 @@ where &self, tx_hashes: Vec, limit: GetPooledTransactionLimit, - ) -> Vec::Transaction as PoolTransaction>::Pooled>> + ) -> Vec<<::Transaction as PoolTransaction>::Pooled> where ::Transaction: EthPoolTransaction, { @@ -354,7 +354,7 @@ where }; size += encoded_len; - elements.push(pooled); + elements.push(pooled.into_signed()); if limit.exceeds(size) { break diff --git a/crates/transaction-pool/src/traits.rs b/crates/transaction-pool/src/traits.rs index fd28365cedd1..aa238ded2f0d 100644 --- a/crates/transaction-pool/src/traits.rs +++ b/crates/transaction-pool/src/traits.rs @@ -236,7 +236,7 @@ pub trait TransactionPool: Send + Sync + Clone { &self, tx_hashes: Vec, limit: GetPooledTransactionLimit, - ) -> Vec::Pooled>>; + ) -> Vec<::Pooled>; /// Returns the pooled transaction variant for the given transaction hash. ///