Skip to content
Snippets Groups Projects
Unverified Commit 6fda6a67 authored by Max Inden's avatar Max Inden
Browse files

core/network/sync: Request specific fork sync from peers ahead or on par

When making an explicit fork sync request without specifying any peers,
make sure to only request it from the locally known peers that are
either ahead or on a par compared to the block number we are looking
for.
parent 0805651d
Branches
Tags
No related merge requests found
......@@ -465,7 +465,11 @@ impl<B: BlockT> ChainSync<B> {
hash, peers,
);
peers = self.peers.iter().map(|(id, _)| id.clone()).collect();
peers = self.peers.iter()
// Only request blocks from peers who are ahead or on a par.
.filter(|(id, peer)| peer.best_number >= number)
.map(|(id, _)| id.clone())
.collect();
} else {
debug!(target: "sync", "Explicit sync request for block {:?} with {:?}", hash, peers);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment