Skip to content

Commit

Permalink
Sync mn list and mnw list from 3 peers max (dashpay#2169)
Browse files Browse the repository at this point in the history
Should solve issues with initial sync and reduce load/bandwidth in general.
  • Loading branch information
UdjinM6 authored Jul 7, 2018
1 parent 2c303cd commit 2474d9c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/masternode-sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 2474d9c

Please sign in to comment.