Skip to content

Commit

Permalink
feat(mempool): add from_iter func to TransactionPool
Browse files Browse the repository at this point in the history
  • Loading branch information
ayeletstarkware committed Jul 9, 2024
1 parent 19a67ef commit 94776ad
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/mempool/src/mempool_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ThinTransaction> for TransactionPool {
fn from_iter<T: IntoIterator<Item = ThinTransaction>>(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) {
Expand Down

0 comments on commit 94776ad

Please sign in to comment.