From 282dcf30e001edd46fc2b9bb3d1d48e246a0b7d4 Mon Sep 17 00:00:00 2001 From: Ayelet Zilber Date: Tue, 9 Jul 2024 13:55:20 +0300 Subject: [PATCH] feat(mempool): add from_iter func to TransactionQueue --- 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 9d87ef90..76e80005 100644 --- a/crates/mempool/src/mempool_test.rs +++ b/crates/mempool/src/mempool_test.rs @@ -12,6 +12,7 @@ use starknet_types_core::felt::Felt; use crate::mempool::{Mempool, MempoolInput, TransactionReference}; use crate::transaction_pool::TransactionPool; +use crate::transaction_queue::TransactionQueue; impl FromIterator for TransactionPool { fn from_iter>(txs: T) -> Self { @@ -23,6 +24,16 @@ impl FromIterator for TransactionPool { } } +impl FromIterator for TransactionQueue { + fn from_iter>(txs: T) -> Self { + let mut queue = Self::default(); + for tx in txs { + queue.insert(tx); + } + queue + } +} + #[track_caller] fn add_tx(mempool: &mut Mempool, input: &MempoolInput) { assert_eq!(mempool.add_tx(input.clone()), Ok(()));