mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 05:23:01 +01:00
define masternode sync treshold
This commit is contained in:
parent
a01e56a67d
commit
d79ac2bd60
@ -81,7 +81,7 @@ void CMasternodeSync::Reset()
|
|||||||
void CMasternodeSync::AddedMasternodeList(uint256 hash)
|
void CMasternodeSync::AddedMasternodeList(uint256 hash)
|
||||||
{
|
{
|
||||||
if(mnodeman.mapSeenMasternodeBroadcast.count(hash)) {
|
if(mnodeman.mapSeenMasternodeBroadcast.count(hash)) {
|
||||||
if(mapSeenSyncMNB[hash] < 2) {
|
if(mapSeenSyncMNB[hash] < MASTERNODE_SYNC_TRESHOLD) {
|
||||||
lastMasternodeList = GetTime();
|
lastMasternodeList = GetTime();
|
||||||
mapSeenSyncMNB[hash]++;
|
mapSeenSyncMNB[hash]++;
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ void CMasternodeSync::AddedMasternodeList(uint256 hash)
|
|||||||
void CMasternodeSync::AddedMasternodeWinner(uint256 hash)
|
void CMasternodeSync::AddedMasternodeWinner(uint256 hash)
|
||||||
{
|
{
|
||||||
if(masternodePayments.mapMasternodePayeeVotes.count(hash)) {
|
if(masternodePayments.mapMasternodePayeeVotes.count(hash)) {
|
||||||
if(mapSeenSyncMNW[hash] < 2) {
|
if(mapSeenSyncMNW[hash] < MASTERNODE_SYNC_TRESHOLD) {
|
||||||
lastMasternodeWinner = GetTime();
|
lastMasternodeWinner = GetTime();
|
||||||
mapSeenSyncMNW[hash]++;
|
mapSeenSyncMNW[hash]++;
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ void CMasternodeSync::AddedBudgetItem(uint256 hash)
|
|||||||
{
|
{
|
||||||
if(budget.mapSeenMasternodeBudgetProposals.count(hash) || budget.mapSeenMasternodeBudgetVotes.count(hash) ||
|
if(budget.mapSeenMasternodeBudgetProposals.count(hash) || budget.mapSeenMasternodeBudgetVotes.count(hash) ||
|
||||||
budget.mapSeenFinalizedBudgets.count(hash) || budget.mapSeenFinalizedBudgetVotes.count(hash)) {
|
budget.mapSeenFinalizedBudgets.count(hash) || budget.mapSeenFinalizedBudgetVotes.count(hash)) {
|
||||||
if(mapSeenSyncBudget[hash] < 2) {
|
if(mapSeenSyncBudget[hash] < MASTERNODE_SYNC_TRESHOLD) {
|
||||||
lastBudgetItem = GetTime();
|
lastBudgetItem = GetTime();
|
||||||
mapSeenSyncBudget[hash]++;
|
mapSeenSyncBudget[hash]++;
|
||||||
}
|
}
|
||||||
@ -276,7 +276,7 @@ void CMasternodeSync::Process()
|
|||||||
|
|
||||||
if(RequestedMasternodeAssets == MASTERNODE_SYNC_LIST) {
|
if(RequestedMasternodeAssets == MASTERNODE_SYNC_LIST) {
|
||||||
if(fDebug) LogPrintf("CMasternodeSync::Process() - lastMasternodeList %lld (GetTime() - MASTERNODE_SYNC_TIMEOUT) %lld\n", lastMasternodeList, GetTime() - MASTERNODE_SYNC_TIMEOUT);
|
if(fDebug) LogPrintf("CMasternodeSync::Process() - lastMasternodeList %lld (GetTime() - MASTERNODE_SYNC_TIMEOUT) %lld\n", lastMasternodeList, GetTime() - MASTERNODE_SYNC_TIMEOUT);
|
||||||
if(lastMasternodeList > 0 && lastMasternodeList < GetTime() - MASTERNODE_SYNC_TIMEOUT && RequestedMasternodeAttempt >= 4){ //hasn't received a new item in the last five seconds, so we'll move to the
|
if(lastMasternodeList > 0 && lastMasternodeList < GetTime() - MASTERNODE_SYNC_TIMEOUT && RequestedMasternodeAttempt >= MASTERNODE_SYNC_TRESHOLD){ //hasn't received a new item in the last five seconds, so we'll move to the
|
||||||
GetNextAsset();
|
GetNextAsset();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -290,7 +290,7 @@ void CMasternodeSync::Process()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(RequestedMasternodeAssets == MASTERNODE_SYNC_MNW) {
|
if(RequestedMasternodeAssets == MASTERNODE_SYNC_MNW) {
|
||||||
if(lastMasternodeWinner > 0 && lastMasternodeWinner < GetTime() - MASTERNODE_SYNC_TIMEOUT && RequestedMasternodeAttempt >= 4){ //hasn't received a new item in the last five seconds, so we'll move to the
|
if(lastMasternodeWinner > 0 && lastMasternodeWinner < GetTime() - MASTERNODE_SYNC_TIMEOUT && RequestedMasternodeAttempt >= MASTERNODE_SYNC_TRESHOLD){ //hasn't received a new item in the last five seconds, so we'll move to the
|
||||||
GetNextAsset();
|
GetNextAsset();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -314,7 +314,7 @@ void CMasternodeSync::Process()
|
|||||||
|
|
||||||
if(RequestedMasternodeAssets == MASTERNODE_SYNC_BUDGET){
|
if(RequestedMasternodeAssets == MASTERNODE_SYNC_BUDGET){
|
||||||
//we'll start rejecting votes if we accidentally get set as synced too soon
|
//we'll start rejecting votes if we accidentally get set as synced too soon
|
||||||
if(lastBudgetItem > 0 && lastBudgetItem < GetTime() - MASTERNODE_SYNC_TIMEOUT && RequestedMasternodeAttempt >= 4){ //hasn't received a new item in the last five seconds, so we'll move to the
|
if(lastBudgetItem > 0 && lastBudgetItem < GetTime() - MASTERNODE_SYNC_TIMEOUT && RequestedMasternodeAttempt >= MASTERNODE_SYNC_TRESHOLD){ //hasn't received a new item in the last five seconds, so we'll move to the
|
||||||
//LogPrintf("CMasternodeSync::Process - HasNextFinalizedBudget %d nCountFailures %d IsBudgetPropEmpty %d\n", budget.HasNextFinalizedBudget(), nCountFailures, IsBudgetPropEmpty());
|
//LogPrintf("CMasternodeSync::Process - HasNextFinalizedBudget %d nCountFailures %d IsBudgetPropEmpty %d\n", budget.HasNextFinalizedBudget(), nCountFailures, IsBudgetPropEmpty());
|
||||||
//if(budget.HasNextFinalizedBudget() || nCountFailures >= 2 || IsBudgetPropEmpty()) {
|
//if(budget.HasNextFinalizedBudget() || nCountFailures >= 2 || IsBudgetPropEmpty()) {
|
||||||
GetNextAsset();
|
GetNextAsset();
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#define MASTERNODE_SYNC_FINISHED 999
|
#define MASTERNODE_SYNC_FINISHED 999
|
||||||
|
|
||||||
#define MASTERNODE_SYNC_TIMEOUT 7
|
#define MASTERNODE_SYNC_TIMEOUT 7
|
||||||
|
#define MASTERNODE_SYNC_TRESHOLD 4
|
||||||
|
|
||||||
class CMasternodeSync;
|
class CMasternodeSync;
|
||||||
extern CMasternodeSync masternodeSync;
|
extern CMasternodeSync masternodeSync;
|
||||||
|
@ -771,12 +771,12 @@ void BitcoinGUI::setNumBlocks(int count)
|
|||||||
spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES;
|
spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES;
|
||||||
prevAttempt = masternodeSync.RequestedMasternodeAttempt + 1;
|
prevAttempt = masternodeSync.RequestedMasternodeAttempt + 1;
|
||||||
prevAssets = masternodeSync.RequestedMasternodeAssets;
|
prevAssets = masternodeSync.RequestedMasternodeAssets;
|
||||||
if(prevAttempt <= 4) progress = prevAttempt + (prevAssets - 1) * 4;
|
if(prevAttempt <= MASTERNODE_SYNC_TRESHOLD) progress = prevAttempt + (prevAssets - 1) * MASTERNODE_SYNC_TRESHOLD;
|
||||||
progressBar->setValue(progress);
|
progressBar->setValue(progress);
|
||||||
}
|
}
|
||||||
switch (masternodeSync.RequestedMasternodeAssets) {
|
switch (masternodeSync.RequestedMasternodeAssets) {
|
||||||
case MASTERNODE_SYNC_SPORKS:
|
case MASTERNODE_SYNC_SPORKS:
|
||||||
progressBar->setMaximum(4 * 4);
|
progressBar->setMaximum(4 * MASTERNODE_SYNC_TRESHOLD);
|
||||||
progressBarLabel->setText(tr("Synchronizing sporks..."));
|
progressBarLabel->setText(tr("Synchronizing sporks..."));
|
||||||
break;
|
break;
|
||||||
case MASTERNODE_SYNC_LIST:
|
case MASTERNODE_SYNC_LIST:
|
||||||
|
Loading…
Reference in New Issue
Block a user