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

Test for syncing fork not fitting into one response #14735

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions client/network/test/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,20 @@ async fn sync_no_common_longer_chain_fails() {
assert!(!net.peers()[0].blockchain_canon_equals(peer1));
}

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn sync_fork_multiple_responses_works() {
sp_tracing::try_init_simple();
let mut net = TestNet::new(2);

// NOTE: the test succeeds if we push <= 128 blocks below.
let f0_best = net.peer(0).push_blocks(129, true).pop().unwrap();
net.peer(1).push_blocks(130, false);

net.run_until_sync().await;

assert!(net.peer(1).has_block(f0_best));
}

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn sync_justifications() {
sp_tracing::try_init_simple();
Expand Down