From 6bc72cea62c6abf78e97c1c75c01f202a0726dba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= Date: Thu, 15 Aug 2019 19:47:09 +0100 Subject: [PATCH] sync: fix peer common number on block announce (#3410) --- substrate/core/network/src/protocol/sync.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/substrate/core/network/src/protocol/sync.rs b/substrate/core/network/src/protocol/sync.rs index bd67c6cde7..625d9a840a 100644 --- a/substrate/core/network/src/protocol/sync.rs +++ b/substrate/core/network/src/protocol/sync.rs @@ -922,10 +922,10 @@ impl ChainSync { } // We assume that the announced block is the latest they have seen, and so our common number // is either one further ahead or it's the one they just announced, if we know about it. - if header.parent_hash() == &self.best_queued_hash || known_parent { - peer.common_number = number - One::one(); - } else if known { + if known { peer.common_number = number + } else if header.parent_hash() == &self.best_queued_hash || known_parent { + peer.common_number = number - One::one(); } self.is_idle = false;