fine-tune sync conditions in getblocktemplate (#1739)

This commit is contained in:
UdjinM6 2017-12-01 08:14:57 +03:00 committed by GitHub
parent 70cb2a4af5
commit 3280097495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,9 @@
#include "utilstrencodings.h"
#include "validationinterface.h"
#include "masternode-payments.h"
#include "governance-classes.h"
#include <stdint.h>
#include <boost/assign/list_of.hpp>
@ -498,7 +501,17 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
if (IsInitialBlockDownload())
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Dash Core is downloading blocks...");
if (!masternodeSync.IsSynced())
// when enforcement is on we need information about a masternode payee or otherwise our block is going to be orphaned by the network
CScript payee;
if (sporkManager.IsSporkActive(SPORK_8_MASTERNODE_PAYMENT_ENFORCEMENT)
&& !masternodeSync.IsWinnersListSynced()
&& !mnpayments.GetBlockPayee(chainActive.Height() + 1, payee))
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Dash Core is downloading masternode winners...");
// next bock is a superblock and we need governance info to correctly construct it
if (sporkManager.IsSporkActive(SPORK_9_SUPERBLOCKS_ENABLED)
&& !masternodeSync.IsSynced()
&& CSuperblock::IsValidBlockHeight(chainActive.Height() + 1))
throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "Dash Core is syncing with network...");
static unsigned int nTransactionsUpdatedLast;