mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Fixed syncing code for stuck clients
This commit is contained in:
parent
4b6d55b1b9
commit
a89b0e705f
@ -2356,25 +2356,32 @@ void ThreadCheckDarkSendPool()
|
||||
if(c % 5 == 0 && RequestedMasternodeAssets <= 2){
|
||||
bool fIsInitialDownload = IsInitialBlockDownload();
|
||||
if(!fIsInitialDownload) {
|
||||
LOCK(cs_vNodes);
|
||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||
{
|
||||
if (pnode->nVersion >= MIN_POOL_PEER_PROTO_VERSION) {
|
||||
CBlockIndex* pindexPrev = chainActive.Tip();
|
||||
if(pindexPrev != NULL) {
|
||||
if(pindexPrev->nTime > GetAdjustedTime() - (60*24))
|
||||
{
|
||||
|
||||
//keep track of who we've asked for the list
|
||||
if(pnode->HasFulfilledRequest("mnsync")) continue;
|
||||
pnode->FulfilledRequest("mnsync");
|
||||
LOCK(cs_vNodes);
|
||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||
{
|
||||
if (pnode->nVersion >= MIN_POOL_PEER_PROTO_VERSION) {
|
||||
|
||||
LogPrintf("Successfully synced, asking for Masternode list and payment list\n");
|
||||
//keep track of who we've asked for the list
|
||||
if(pnode->HasFulfilledRequest("mnsync")) continue;
|
||||
pnode->FulfilledRequest("mnsync");
|
||||
|
||||
//request full mn list only if Masternodes.dat was updated quite a long time ago
|
||||
mnodeman.DsegUpdate(pnode);
|
||||
LogPrintf("Successfully synced, asking for Masternode list and payment list\n");
|
||||
|
||||
pnode->PushMessage("mnget"); //sync payees
|
||||
pnode->PushMessage("mnvs"); //sync masternode votes
|
||||
pnode->PushMessage("getsporks"); //get current network sporks
|
||||
RequestedMasternodeAssets++;
|
||||
break;
|
||||
//request full mn list only if Masternodes.dat was updated quite a long time ago
|
||||
mnodeman.DsegUpdate(pnode);
|
||||
|
||||
pnode->PushMessage("mnget"); //sync payees
|
||||
pnode->PushMessage("mnvs"); //sync masternode votes
|
||||
pnode->PushMessage("getsporks"); //get current network sporks
|
||||
RequestedMasternodeAssets++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,6 +85,9 @@ public:
|
||||
mapFinalizedBudgets.clear();
|
||||
}
|
||||
|
||||
int sizeFinalized() {return (int)mapFinalizedBudgets.size();}
|
||||
int sizeProposals() {return (int)mapProposals.size();}
|
||||
|
||||
void Sync(CNode* node);
|
||||
|
||||
void Calculate();
|
||||
|
@ -23,15 +23,14 @@ bool IsBlockValueValid(int64_t nBlockValue, int64_t nExpectedValue){
|
||||
CBlockIndex* pindexPrev = chainActive.Tip();
|
||||
if(pindexPrev == NULL) return true;
|
||||
|
||||
//while syncing take the longest chain
|
||||
if (fImporting || fReindex || pindexPrev->nHeight+1 < Checkpoints::GetTotalBlocksEstimate()) {
|
||||
if(budget.sizeFinalized() == 0 && budget.sizeProposals() == 0) { //there is no budget data to use to check anything
|
||||
//super blocks will always be on these blocks, max 100 per budgeting
|
||||
if((pindexPrev->nHeight+1) % GetBudgetPaymentCycleBlocks() < 100){
|
||||
return true;
|
||||
} else {
|
||||
if(nBlockValue > nExpectedValue) return false;
|
||||
}
|
||||
} else { // we're synced so check the budget schedule
|
||||
} else { // we're synced and have data so check the budget schedule
|
||||
if(budget.IsBudgetPaymentBlock(pindexPrev->nHeight+1)){
|
||||
//the value of the block is evaluated in CheckBlock
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user