From 2474d9cb8ccd2416d50edbca08c1957def60b771 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sun, 8 Jul 2018 00:19:54 +0300 Subject: [PATCH] Sync mn list and mnw list from 3 peers max (#2169) Should solve issues with initial sync and reduce load/bandwidth in general. --- src/masternode-sync.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/masternode-sync.cpp b/src/masternode-sync.cpp index 8db13e76be..589225260a 100644 --- a/src/masternode-sync.cpp +++ b/src/masternode-sync.cpp @@ -259,6 +259,12 @@ void CMasternodeSync::ProcessTick(CConnman& connman) return; } + // request from three peers max + if (nRequestedMasternodeAttempt > 2) { + connman.ReleaseNodeVector(vNodesCopy); + return; + } + // only request once from each peer if(netfulfilledman.HasFulfilledRequest(pnode->addr, "masternode-list-sync")) continue; netfulfilledman.AddFulfilledRequest(pnode->addr, "masternode-list-sync"); @@ -303,6 +309,12 @@ void CMasternodeSync::ProcessTick(CConnman& connman) return; } + // request from three peers max + if (nRequestedMasternodeAttempt > 2) { + connman.ReleaseNodeVector(vNodesCopy); + return; + } + // only request once from each peer if(netfulfilledman.HasFulfilledRequest(pnode->addr, "masternode-payment-sync")) continue; netfulfilledman.AddFulfilledRequest(pnode->addr, "masternode-payment-sync");