Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion client/network/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,9 @@ where
at: BlockId<Block>,
count: usize,
with_tx: bool,
announce_block: bool,
) -> H256 {
self.generate_tx_blocks_at(at, count, with_tx, false, false, true)
self.generate_tx_blocks_at(at, count, with_tx, false, false, announce_block)
}

/// Push blocks to the peer (simplified: with or without a TX) starting from
Expand Down
21 changes: 14 additions & 7 deletions client/network/test/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,9 @@ fn sync_to_tip_requires_that_sync_protocol_is_informed_about_best_block() {
let mut net = TestNet::new(1);

// Produce some blocks
let block_hash = net.peer(0).push_blocks_at_without_informing_sync(BlockId::Number(0), 3, true);
let block_hash =
net.peer(0)
.push_blocks_at_without_informing_sync(BlockId::Number(0), 3, true, true);

// Add a node and wait until they are connected
net.add_full_peer_with_config(Default::default());
Expand Down Expand Up @@ -818,20 +820,25 @@ fn sync_to_tip_when_we_sync_together_with_multiple_peers() {

let block_hash =
net.peer(0)
.push_blocks_at_without_informing_sync(BlockId::Number(0), 10_000, false);
.push_blocks_at_without_informing_sync(BlockId::Number(0), 10_000, false, false);

let block_hash2 =
net.peer(1)
.push_blocks_at_without_informing_sync(BlockId::Number(0), 5_000, false, false);

net.peer(1)
.push_blocks_at_without_informing_sync(BlockId::Number(0), 5_000, false);
assert!(!net.peer(2).has_block(block_hash));
net.peer(0).network_service().new_best_block_imported(block_hash, 10_000);

net.block_until_connected();
net.block_until_idle();

assert!(!net.peer(2).has_block(block_hash));

net.peer(0).network_service().new_best_block_imported(block_hash, 10_000);
while !net.peer(2).has_block(block_hash) && !net.peer(1).has_block(block_hash) {
net.block_until_idle();
}

// verify that peer1 and peer3 also downloaded the other fork
assert!(net.peer(0).has_block(block_hash2));
assert!(net.peer(2).has_block(block_hash2));
}

/// Ensures that when we receive a block announcement with some data attached, that we propagate
Expand Down