Bail out in few more places when blockchain is not synced yet (#2888)

* Bail out in few more places when blockchain is not synced yet

* Apply review suggestion
This commit is contained in:
UdjinM6 2019-04-30 15:55:11 +03:00 committed by GitHub
parent fd6aaae7f0
commit fbd244dded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View File

@ -15,6 +15,7 @@
#include "activemasternode.h"
#include "chainparams.h"
#include "init.h"
#include "masternode-sync.h"
#include "univalue.h"
#include "validation.h"
@ -161,7 +162,7 @@ CQuorumManager::CQuorumManager(CEvoDB& _evoDb, CBLSWorker& _blsWorker, CDKGSessi
void CQuorumManager::UpdatedBlockTip(const CBlockIndex* pindexNew, bool fInitialDownload)
{
if (fInitialDownload) {
if (!masternodeSync.IsBlockchainSynced()) {
return;
}

View File

@ -9,6 +9,7 @@
#include "quorums_utils.h"
#include "chain.h"
#include "masternode-sync.h"
#include "net_processing.h"
#include "scheduler.h"
#include "spork.h"
@ -232,15 +233,20 @@ void CChainLocksHandler::TrySignChainTip()
{
Cleanup();
if (!fMasternodeMode) {
return;
}
if (!masternodeSync.IsBlockchainSynced()) {
return;
}
const CBlockIndex* pindex;
{
LOCK(cs_main);
pindex = chainActive.Tip();
}
if (!fMasternodeMode) {
return;
}
if (!pindex->pprev) {
return;
}
@ -594,6 +600,10 @@ bool CChainLocksHandler::InternalHasConflictingChainLock(int nHeight, const uint
void CChainLocksHandler::Cleanup()
{
if (!masternodeSync.IsBlockchainSynced()) {
return;
}
{
LOCK(cs);
if (GetTimeMillis() - lastCleanupTime < CLEANUP_INTERVAL) {