@@ -60,7 +60,7 @@ impl MempoolState<PartialState> {
60
60
}
61
61
}
62
62
63
- fn _with_queue < Q > ( queue_txs : Q ) -> Self
63
+ fn with_queue < Q > ( queue_txs : Q ) -> Self
64
64
where
65
65
Q : IntoIterator < Item = TransactionReference > ,
66
66
{
@@ -347,15 +347,25 @@ fn test_add_tx_with_identical_tip_succeeds(mut mempool: Mempool) {
347
347
348
348
#[ rstest]
349
349
fn test_tip_priority_over_tx_hash ( mut mempool : Mempool ) {
350
+ // Setup.
350
351
let input_big_tip_small_hash = add_tx_input ! ( tip: 2 , tx_hash: Felt :: ONE ) ;
351
352
352
353
// Create a transaction with identical tip, it should be allowed through since the priority
353
354
// queue tie-breaks identical tips by other tx-unique identifiers (for example tx hash).
354
355
let input_small_tip_big_hash = add_tx_input ! ( tip: 1 , tx_hash: Felt :: TWO , sender_address: "0x1" ) ;
355
356
357
+ // Test.
356
358
add_tx ( & mut mempool, & input_big_tip_small_hash) ;
357
359
add_tx ( & mut mempool, & input_small_tip_big_hash) ;
358
- assert_eq_mempool_queue ( & mempool, & [ input_big_tip_small_hash. tx , input_small_tip_big_hash. tx ] )
360
+
361
+ // Assert: ensure that the transaction with the higher tip is prioritized higher.
362
+ let expected_queue_txs = [
363
+ TransactionReference :: new ( & input_big_tip_small_hash. tx ) ,
364
+ TransactionReference :: new ( & input_small_tip_big_hash. tx ) ,
365
+ ] ;
366
+ let expected_mempool_state = MempoolState :: with_queue ( expected_queue_txs) ;
367
+
368
+ expected_mempool_state. assert_eq_queue_state ( & mempool) ;
359
369
}
360
370
361
371
#[ rstest]
0 commit comments