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

Fixed sync stalling when import queue is full #679

Merged
merged 2 commits into from
Sep 7, 2018
Merged
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
8 changes: 8 additions & 0 deletions substrate/network/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ impl<B: BlockT> ChainSync<B> {
let is_best = new_blocks.first().and_then(|b| b.block.header.as_ref()).map(|h| best_seen.as_ref().map_or(false, |n| h.number() >= n));
let origin = if is_best.unwrap_or_default() { BlockOrigin::NetworkBroadcast } else { BlockOrigin::NetworkInitialSync };
let import_queue = self.import_queue.clone();
if let Some((hash, number)) = new_blocks.last()
.and_then(|b| b.block.header.as_ref().map(|h|(b.block.hash.clone(), *h.number())))
{
if number > self.best_queued_number {
self.best_queued_number = number;
self.best_queued_hash = hash;
}
}
import_queue.import_blocks(self, protocol, (origin, new_blocks));
self.maintain_sync(protocol);
}
Expand Down