diff --git a/crates/mempool/src/mempool_test.rs b/crates/mempool/src/mempool_test.rs index 8ee7256f8..8f015548a 100644 --- a/crates/mempool/src/mempool_test.rs +++ b/crates/mempool/src/mempool_test.rs @@ -421,3 +421,25 @@ fn test_flow_filling_holes(mut mempool: Mempool) { // Assert: all remaining transactions are returned. assert_eq!(txs, &[input_address_0_nonce_0.tx]); } + +#[rstest] +#[ignore] + +fn test_commit_block_rewinds_nonce() { + // Setup. + let tx_address0_nonce5 = add_tx_input!(tip: 1, tx_hash: 2, sender_address: "0x0", tx_nonce: 5_u8, account_nonce: 4_u8).tx; + + let queued_txs = [TransactionReference::new(&tx_address0_nonce5)]; + let pool_txs = [tx_address0_nonce5]; + let mut mempool: Mempool = MempoolState::new(pool_txs, queued_txs).into(); + + // Test. + let state_changes = HashMap::from([ + (contract_address!("0x0"), AccountState { nonce: Nonce(felt!(3_u16)) }), + (contract_address!("0x1"), AccountState { nonce: Nonce(felt!(3_u16)) }), + ]); + assert!(mempool.commit_block(state_changes).is_ok()); + + // Assert. + assert_eq_mempool_queue(&mempool, &[]) +}