Skip to content

Commit 9c52d72

Browse files
test(mempool): refactor test_add_tx_with_duplicate_tx to use mempool state
1 parent 7479fd6 commit 9c52d72

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
@@ -224,16 +224,21 @@ fn test_new_with_duplicate_tx() {
224224
#[rstest]
225225
fn test_add_tx_with_duplicate_tx(mut mempool: Mempool) {
226226
let input = add_tx_input!(tip: 50, tx_hash: Felt::ONE);
227-
let same_input = input.clone();
227+
let duplicate_input = input.clone();
228228

229229
add_tx(&mut mempool, &input);
230230

231231
assert_matches!(
232-
mempool.add_tx(same_input.clone()),
232+
mempool.add_tx(duplicate_input),
233233
Err(MempoolError::DuplicateTransaction { .. })
234234
);
235-
// Assert that the original tx remains in the pool after the failed attempt.
236-
assert_eq_mempool_queue(&mempool, &[same_input.tx])
235+
236+
// Assert that the original tx remains in Mempool after the failed attempt.
237+
let queue_txs = [TransactionReference::new(&input.tx)];
238+
let pool_txs = [input.tx];
239+
let expected_mempool_state = MempoolState::new(pool_txs, queue_txs);
240+
241+
expected_mempool_state.assert_eq_mempool_state(&mempool);
237242
}
238243

239244
#[rstest]

0 commit comments

Comments
 (0)