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

Commit

Permalink
Allow ancient fork download after ancestry search (#4080)
Browse files Browse the repository at this point in the history
  • Loading branch information
arkpar authored and bkchr committed Nov 11, 2019
1 parent 911836b commit 9c9d711
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions core/network/src/protocol/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,12 +704,8 @@ impl<B: BlockT> ChainSync<B> {
matching_hash,
peer.common_number,
);
let client = &self.client;
if peer.common_number < peer.best_number
&& peer.best_number < self.best_queued_number
&& matching_hash.and_then(
|h| client.block_status(&BlockId::Hash(h)).ok()
).unwrap_or(BlockStatus::Unknown) != BlockStatus::InChainPruned
{
trace!(target: "sync", "Added fork target {} for {}" , peer.best_hash, who);
self.fork_targets
Expand Down
4 changes: 2 additions & 2 deletions core/network/src/test/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,9 @@ fn syncs_header_only_forks() {
net.peer(1).push_blocks(4, false);

net.block_until_sync(&mut runtime);
// Peer 1 won't sync the small fork because common block state is missing
// Peer 1 will sync the small fork even though common block state is missing
assert_eq!(9, net.peer(0).blocks_count());
assert_eq!(7, net.peer(1).blocks_count());
assert_eq!(9, net.peer(1).blocks_count());

// Request explicit header-only sync request for the ancient fork.
let first_peer_id = net.peer(0).id();
Expand Down

0 comments on commit 9c9d711

Please sign in to comment.