Fixed sync stalling when import queue is full
@@ -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);
}
