File tree 1 file changed +9
-6
lines changed
1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ impl Default for MempoolState<PartialState> {
50
50
}
51
51
52
52
impl MempoolState < PartialState > {
53
- fn _with_pool < P > ( pool_txs : P ) -> Self
53
+ fn with_pool < P > ( pool_txs : P ) -> Self
54
54
where
55
55
P : IntoIterator < Item = ThinTransaction > ,
56
56
{
@@ -298,17 +298,20 @@ fn test_new_with_duplicate_tx() {
298
298
299
299
#[ rstest]
300
300
fn test_add_tx_with_duplicate_tx ( mut mempool : Mempool ) {
301
+ // Setup
301
302
let input = add_tx_input ! ( tip: 50 , tx_hash: Felt :: ONE ) ;
302
- let same_input = input. clone ( ) ;
303
+ let duplicate_input = input. clone ( ) ;
303
304
305
+ // Test: assert that the duplicate tx is not added to the mempool.
304
306
add_tx ( & mut mempool, & input) ;
305
-
306
307
assert_matches ! (
307
- mempool. add_tx( same_input . clone ( ) ) ,
308
+ mempool. add_tx( duplicate_input ) ,
308
309
Err ( MempoolError :: DuplicateTransaction { .. } )
309
310
) ;
310
- // Assert that the original tx remains in the pool after the failed attempt.
311
- assert_eq_mempool_queue ( & mempool, & [ same_input. tx ] )
311
+
312
+ // Assert: the original tx remains in Mempool after the failed attempt.
313
+ let expected_mempool_state = MempoolState :: with_pool ( [ input. tx ] ) ;
314
+ expected_mempool_state. assert_eq_pool_state ( & mempool) ;
312
315
}
313
316
314
317
#[ rstest]
You can’t perform that action at this time.
0 commit comments