Failing test case for #656

This commit is contained in:
Tomasz Drwięga 2016-03-10 11:11:59 +01:00
parent c3803807a9
commit 276768a826

View File

@ -541,6 +541,28 @@ mod test {
assert_eq!(top[0], tx); assert_eq!(top[0], tx);
} }
#[test]
fn should_correctly_update_futures_when_removing() {
// given
let prev_nonce = |a: &Address| default_nonce(a) - U256::one();
let next2_nonce = |a: &Address| default_nonce(a) + U256::from(2);
let mut txq = TransactionQueue::new();
let (tx, tx2) = new_txs(U256::from(1));
txq.add(tx.clone(), &prev_nonce);
txq.add(tx2.clone(), &prev_nonce);
assert_eq!(txq.status().future, 2);
// when
txq.remove(&tx.hash(), &next2_nonce);
// should remove both transactions since they are not valid
// then
assert_eq!(txq.status().pending, 0);
assert_eq!(txq.status().future, 0);
}
#[test] #[test]
fn should_move_transactions_if_gap_filled() { fn should_move_transactions_if_gap_filled() {
// given // given