File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -223,17 +223,23 @@ fn test_new_with_duplicate_tx() {
223
223
224
224
#[ rstest]
225
225
fn test_add_tx_with_duplicate_tx ( mut mempool : Mempool ) {
226
+ // Setup
226
227
let input = add_tx_input ! ( tip: 50 , tx_hash: Felt :: ONE ) ;
227
- let same_input = input. clone ( ) ;
228
+ let duplicate_input = input. clone ( ) ;
228
229
230
+ // Test: assert that the duplicate tx is not added to the mempool.
229
231
add_tx ( & mut mempool, & input) ;
230
-
231
232
assert_matches ! (
232
- mempool. add_tx( same_input . clone ( ) ) ,
233
+ mempool. add_tx( duplicate_input ) ,
233
234
Err ( MempoolError :: DuplicateTransaction { .. } )
234
235
) ;
235
- // Assert that the original tx remains in the pool after the failed attempt.
236
- assert_eq_mempool_queue ( & mempool, & [ same_input. tx ] )
236
+
237
+ // Assert that the original tx remains in Mempool after the failed attempt.
238
+ let expected_queue_txs = [ TransactionReference :: new ( & input. tx ) ] ;
239
+ let expected_pool_txs = [ input. tx ] ;
240
+ let expected_mempool_state = MempoolState :: new ( expected_pool_txs, expected_queue_txs) ;
241
+
242
+ expected_mempool_state. assert_eq_mempool_state ( & mempool) ;
237
243
}
238
244
239
245
#[ rstest]
You can’t perform that action at this time.
0 commit comments