Skip to content

Commit 7a0222a

Browse files
test(mempool): refactor test_add_tx_with_duplicate_tx to use mempool state
1 parent ba6056d commit 7a0222a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

crates/mempool/src/mempool_test.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -200,16 +200,21 @@ fn test_new_with_duplicate_tx() {
200200
#[rstest]
201201
fn test_add_tx_with_duplicate_tx(mut mempool: Mempool) {
202202
let input = add_tx_input!(tip: 50, tx_hash: Felt::ONE);
203-
let same_input = input.clone();
203+
let duplicate_input = input.clone();
204204

205205
add_tx(&mut mempool, &input);
206206

207207
assert_matches!(
208-
mempool.add_tx(same_input.clone()),
208+
mempool.add_tx(duplicate_input),
209209
Err(MempoolError::DuplicateTransaction { .. })
210210
);
211-
// Assert that the original tx remains in the pool after the failed attempt.
212-
assert_eq_mempool_queue(&mempool, &[same_input.tx])
211+
212+
// Assert that the original tx remains in Mempool after the failed attempt.
213+
let queue_txs = [TransactionReference::new(&input.tx)];
214+
let pool_txs = [input.tx];
215+
let mempool_state = MempoolState::new(pool_txs, queue_txs);
216+
217+
mempool_state.assert_eq_mempool_state(&mempool);
213218
}
214219

215220
#[rstest]

0 commit comments

Comments
 (0)