Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
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
7 changes: 7 additions & 0 deletions core/network/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,13 @@ impl<B: BlockT> ChainSync<B> {
}
},
None => {
if n > As::sa(0) {
trace!(target:"sync", "Ancestry block not found for peer {}: block #{}", who, n);
let n = n - As::sa(1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One::one() is more idiomatic.

Suggested change
let n = n - As::sa(1);
let n = n - One::one();

peer.state = PeerSyncState::AncestorSearch(n);
Self::request_ancestry(protocol, who, n);
return None;
}
trace!(target:"sync", "Invalid response when searching for ancestor from {}", who);
protocol.report_peer(who, Severity::Bad("Invalid response when searching for ancestor"));
return None;
Expand Down