Don't update common block on ancient block import
@@ -974,13 +974,12 @@ impl<B: BlockT> ChainSync<B> {
/// Updates our internal state for best queued block and then goes
/// through all peers to update our view of their state as well.
fn on_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;
- }
if let Some(_) = self.fork_targets.remove(&hash) {
trace!(target: "sync", "Completed fork sync {:?}", hash);
}
+ if number > self.best_queued_number {
+ self.best_queued_number = number;
+ self.best_queued_hash = *hash;
// Update common blocks
for (n, peer) in self.peers.iter_mut() {
if let PeerSyncState::AncestorSearch(_, _) = peer.state {
@@ -1003,6 +1002,7 @@ impl<B: BlockT> ChainSync<B> {
);
peer.common_number = new_common_number;
}
+ }
self.is_idle = false;
}
