From cac6181c21ea61a4226a9f77926c149deb907f56 Mon Sep 17 00:00:00 2001 From: Ignotus Peverell Date: Sun, 3 Dec 2017 12:46:00 +0000 Subject: [PATCH] Check before borrow, fixes #267 --- grin/src/adapters.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grin/src/adapters.rs b/grin/src/adapters.rs index e9749bd9a..01f5f7975 100644 --- a/grin/src/adapters.rs +++ b/grin/src/adapters.rs @@ -249,7 +249,7 @@ impl NetAdapter for NetToChainAdapter { self.total_height() ); - if self.p2p_server.is_initialized() { + if diff.into_num() > 0 && self.p2p_server.is_initialized() { if let Some(peer) = self.p2p_server.borrow().get_peer(&addr) { let mut peer = peer.write().unwrap(); peer.info.total_difficulty = diff; @@ -321,7 +321,7 @@ impl NetToChainAdapter { } self.syncing.load(Ordering::Relaxed) } - + // recursively go back through the locator vector and stop when we find // a header that we recognize this will be a header shared in common // between us and the peer