From 90acb6eafeb551b6a33afab7158c65d3596682ce 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 78c06cc1..9d87ef90 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, AccountState, ThinTransacti use starknet_types_core::felt::Felt; use crate::mempool::{Mempool, MempoolInput, TransactionReference}; +use crate::transaction_pool::TransactionPool; + +impl FromIterator for TransactionPool { + fn from_iter>(txs: T) -> Self { + let mut pool = Self::default(); + for tx in txs { + pool.insert(tx).unwrap(); + } + pool + } +} #[track_caller] fn add_tx(mempool: &mut Mempool, input: &MempoolInput) {