From 06794ab36cae19e54ecc96ea2b800de9fa32e2c7 Mon Sep 17 00:00:00 2001 From: catbref Date: Tue, 12 Nov 2019 16:25:55 +0000 Subject: [PATCH] Relax minimum peer conditions for synchronization --- src/main/java/org/qora/controller/Controller.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/qora/controller/Controller.java b/src/main/java/org/qora/controller/Controller.java index 6e0950d5..f4404b72 100644 --- a/src/main/java/org/qora/controller/Controller.java +++ b/src/main/java/org/qora/controller/Controller.java @@ -452,14 +452,17 @@ public class Controller extends Thread { // Disregard peers that don't have a recent block peers.removeIf(hasNoRecentBlock); + // Check we have enough peers to potentially synchronize + if (peers.size() < Settings.getInstance().getMinBlockchainPeers()) + return; + // Disregard peers that have no block signature or the same block signature as us peers.removeIf(hasNoOrSameBlock); // Disregard peers that are on the same block as last sync attempt and we didn't like their chain peers.removeIf(hasInferiorChainTip); - // Check we have enough peers to potentially synchronize - if (peers.size() < Settings.getInstance().getMinBlockchainPeers()) + if (peers.isEmpty()) return; // Pick random peer to sync with