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

Commit 2ed4058

Browse files
authoredNov 30, 2022
Don't announce blocks in sync_to_tip_when_we_sync_together_with_multiple_peers (#12783)
* Fix syncing test * cargo fmt * Fix test
1 parent cc36931 commit 2ed4058

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed
 

‎client/network/test/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,9 @@ where
428428
at: BlockId<Block>,
429429
count: usize,
430430
with_tx: bool,
431+
announce_block: bool,
431432
) -> H256 {
432-
self.generate_tx_blocks_at(at, count, with_tx, false, false, true)
433+
self.generate_tx_blocks_at(at, count, with_tx, false, false, announce_block)
433434
}
434435

435436
/// Push blocks to the peer (simplified: with or without a TX) starting from

‎client/network/test/src/sync.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,9 @@ fn sync_to_tip_requires_that_sync_protocol_is_informed_about_best_block() {
775775
let mut net = TestNet::new(1);
776776

777777
// Produce some blocks
778-
let block_hash = net.peer(0).push_blocks_at_without_informing_sync(BlockId::Number(0), 3, true);
778+
let block_hash =
779+
net.peer(0)
780+
.push_blocks_at_without_informing_sync(BlockId::Number(0), 3, true, true);
779781

780782
// Add a node and wait until they are connected
781783
net.add_full_peer_with_config(Default::default());
@@ -818,17 +820,19 @@ fn sync_to_tip_when_we_sync_together_with_multiple_peers() {
818820

819821
let block_hash =
820822
net.peer(0)
821-
.push_blocks_at_without_informing_sync(BlockId::Number(0), 10_000, false);
823+
.push_blocks_at_without_informing_sync(BlockId::Number(0), 10_000, false, false);
822824

823825
net.peer(1)
824-
.push_blocks_at_without_informing_sync(BlockId::Number(0), 5_000, false);
826+
.push_blocks_at_without_informing_sync(BlockId::Number(0), 5_000, false, false);
825827

826828
net.block_until_connected();
827829
net.block_until_idle();
828830

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

831833
net.peer(0).network_service().new_best_block_imported(block_hash, 10_000);
834+
net.peer(0).network_service().announce_block(block_hash, None);
835+
832836
while !net.peer(2).has_block(block_hash) && !net.peer(1).has_block(block_hash) {
833837
net.block_until_idle();
834838
}

0 commit comments

Comments
 (0)