From 94776ad7e35137ba22d58ff8429c9f5f30f75892 Mon Sep 17 00:00:00 2001 From: Ayelet Zilber Date: Tue, 9 Jul 2024 17:08:15 +0300 Subject: [PATCH] feat(mempool): add from_iter func to TransactionPool --- crates/mempool/src/mempool_test.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/mempool/src/mempool_test.rs b/crates/mempool/src/mempool_test.rs index 7f92056a9..048e475ed 100644 --- a/crates/mempool/src/mempool_test.rs +++ b/crates/mempool/src/mempool_test.rs @@ -11,6 +11,17 @@ use starknet_mempool_types::mempool_types::{Account, ThinTransaction}; use starknet_types_core::felt::Felt; use crate::mempool::{Mempool, MempoolInput, TransactionReference}; +use crate::transaction_pool::TransactionPool; + +impl FromIterator for TransactionPool { + fn from_iter>(iter: T) -> TransactionPool { + let mut pool = TransactionPool::default(); + for tx in iter { + pool.insert(tx).unwrap(); + } + pool + } +} #[track_caller] fn add_tx(mempool: &mut Mempool, input: &MempoolInput) {