Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
tx-pool: failing tests fixed (#12481)
Browse files Browse the repository at this point in the history
  • Loading branch information
michalkucharczyk authored Oct 12, 2022
1 parent 94b731c commit 88db102
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions client/transaction-pool/tests/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,8 +1058,8 @@ fn finalized_only_handled_correctly() {
{
let mut stream = futures::executor::block_on_stream(watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(header.clone().hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((header.clone().hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((header.hash(), 0))));
assert_eq!(stream.next(), None);
}
}
Expand Down Expand Up @@ -1087,8 +1087,8 @@ fn best_block_after_finalized_handled_correctly() {
{
let mut stream = futures::executor::block_on_stream(watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(header.clone().hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((header.clone().hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((header.hash(), 0))));
assert_eq!(stream.next(), None);
}
}
Expand Down Expand Up @@ -1155,18 +1155,18 @@ fn switching_fork_with_finalized_works() {
{
let mut stream = futures::executor::block_on_stream(from_alice_watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b1_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Retracted(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b2_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((b2_header.hash(), 0))));
assert_eq!(stream.next(), None);
}

{
let mut stream = futures::executor::block_on_stream(from_bob_watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b2_header.hash(), 1))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((b2_header.hash(), 1))));
assert_eq!(stream.next(), None);
}
}
Expand Down Expand Up @@ -1250,31 +1250,31 @@ fn switching_fork_multiple_times_works() {
let mut stream = futures::executor::block_on_stream(from_alice_watcher);
//phase-0
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b1_header.hash(), 0))));
//phase-1
assert_eq!(stream.next(), Some(TransactionStatus::Retracted(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b2_header.hash(), 0))));
//phase-2
assert_eq!(stream.next(), Some(TransactionStatus::Retracted(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b1_header.hash(), 0))));
//phase-3
assert_eq!(stream.next(), Some(TransactionStatus::Retracted(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b2_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((b2_header.hash(), 0))));
assert_eq!(stream.next(), None);
}

{
let mut stream = futures::executor::block_on_stream(from_bob_watcher);
//phase-1
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b2_header.hash(), 1))));
//phase-2
assert_eq!(stream.next(), Some(TransactionStatus::Retracted(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
//phase-3
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b2_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b2_header.hash(), 1))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((b2_header.hash(), 1))));
assert_eq!(stream.next(), None);
}
}
Expand Down Expand Up @@ -1373,24 +1373,24 @@ fn two_blocks_delayed_finalization_works() {
{
let mut stream = futures::executor::block_on_stream(from_alice_watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b1_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((b1_header.hash(), 0))));
assert_eq!(stream.next(), None);
}

{
let mut stream = futures::executor::block_on_stream(from_bob_watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(c1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(c1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((c1_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((c1_header.hash(), 0))));
assert_eq!(stream.next(), None);
}

{
let mut stream = futures::executor::block_on_stream(from_charlie_watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(d1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(d1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((d1_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((d1_header.hash(), 0))));
assert_eq!(stream.next(), None);
}
}
Expand Down Expand Up @@ -1472,9 +1472,9 @@ fn delayed_finalization_does_not_retract() {
let mut stream = futures::executor::block_on_stream(from_alice_watcher);
//phase-0
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b1_header.hash(), 0))));
//phase-2
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((b1_header.hash(), 0))));
assert_eq!(stream.next(), None);
}

Expand All @@ -1483,9 +1483,9 @@ fn delayed_finalization_does_not_retract() {
//phase-0
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
//phase-1
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(c1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((c1_header.hash(), 0))));
//phase-3
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(c1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((c1_header.hash(), 0))));
assert_eq!(stream.next(), None);
}
}
Expand Down Expand Up @@ -1559,16 +1559,16 @@ fn best_block_after_finalization_does_not_retract() {
{
let mut stream = futures::executor::block_on_stream(from_alice_watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(b1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((b1_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((b1_header.hash(), 0))));
assert_eq!(stream.next(), None);
}

{
let mut stream = futures::executor::block_on_stream(from_bob_watcher);
assert_eq!(stream.next(), Some(TransactionStatus::Ready));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock(c1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized(c1_header.hash())));
assert_eq!(stream.next(), Some(TransactionStatus::InBlock((c1_header.hash(), 0))));
assert_eq!(stream.next(), Some(TransactionStatus::Finalized((c1_header.hash(), 0))));
assert_eq!(stream.next(), None);
}
}

0 comments on commit 88db102

Please sign in to comment.