Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
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
Next Next commit
Fixed common block tracking when syncing
  • Loading branch information
arkpar committed Dec 7, 2018
commit eae1ff59d8667f3b210a8e73dbd5503adb5a4d4c
9 changes: 5 additions & 4 deletions core/network/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,7 @@ impl<B: BlockT> ChainSync<B> {
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;
}
self.block_queued(&hash, number);
}
self.maintain_sync(protocol);
Some((origin, new_blocks))
Expand All @@ -274,6 +271,10 @@ impl<B: BlockT> ChainSync<B> {
}

pub fn block_imported(&mut self, hash: &B::Hash, number: NumberFor<B>) {
trace!(target: "sync", "Block imported successfully {} ({})", number, hash);
}

fn block_queued(&mut self, hash: &B::Hash, number: NumberFor<B>) {
if number > self.best_queued_number {
self.best_queued_number = number;
self.best_queued_hash = *hash;
Expand Down