Skip to content

Commit

Permalink
refactor(mempool): remove underscore from tx_pool getter (#629)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayeletstarkware authored Aug 28, 2024
1 parent cd653ca commit fea531e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/mempool/src/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl Mempool {
}

#[cfg(test)]
pub(crate) fn _tx_pool(&self) -> &TransactionPool {
pub(crate) fn tx_pool(&self) -> &TransactionPool {
&self.tx_pool
}
}
Expand Down
8 changes: 4 additions & 4 deletions crates/mempool/src/mempool_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,24 +850,24 @@ fn test_tx_pool_capacity(mut mempool: Mempool) {
// Test and assert: add txs to the counter.
add_tx(&mut mempool, &input_1);
add_tx(&mut mempool, &input_2);
assert_eq!(mempool._tx_pool().n_txs(), 2);
assert_eq!(mempool.tx_pool().n_txs(), 2);

// Test and assert: duplicate transaction doesn't affect capacity.
add_tx_expect_error(
&mut mempool,
&input_1,
MempoolError::DuplicateTransaction { tx_hash: input_1.tx.tx_hash() },
);
assert_eq!(mempool._tx_pool().n_txs(), 2);
assert_eq!(mempool.tx_pool().n_txs(), 2);

// Test and assert: updates pool capacity when a transaction is removed upon receiving state
// changes.
let state_changes =
HashMap::from([(contract_address!("0x0"), AccountState { nonce: Nonce(felt!(4_u8)) })]);
assert!(mempool.commit_block(state_changes).is_ok());
assert_eq!(mempool._tx_pool().n_txs(), 1);
assert_eq!(mempool.tx_pool().n_txs(), 1);

// Test and assert: remove the transactions, counter does not go below 0.
mempool.get_txs(2).unwrap();
assert_eq!(mempool._tx_pool().n_txs(), 0);
assert_eq!(mempool.tx_pool().n_txs(), 0);
}

0 comments on commit fea531e

Please sign in to comment.