Skip to content

Commit

Permalink
Bail out in few more places when blockchain is not synced yet
Browse files Browse the repository at this point in the history
  • Loading branch information
UdjinM6 committed Apr 28, 2019
1 parent 2652030 commit f642489
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/llmq/quorums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "activemasternode.h"
#include "chainparams.h"
#include "init.h"
#include "masternode-sync.h"
#include "univalue.h"
#include "validation.h"

Expand Down Expand Up @@ -161,7 +162,7 @@ CQuorumManager::CQuorumManager(CEvoDB& _evoDb, CBLSWorker& _blsWorker, CDKGSessi

void CQuorumManager::UpdatedBlockTip(const CBlockIndex* pindexNew, const CBlockIndex* pindexFork, bool fInitialDownload)
{
if (fInitialDownload) {
if (!masternodeSync.IsBlockchainSynced()) {
return;
}

Expand Down
20 changes: 17 additions & 3 deletions src/llmq/quorums_chainlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -407,6 +413,10 @@ bool CChainLocksHandler::IsTxSafeForMining(const uint256& txid)
// This should also not be called from validation signals, as this might result in recursive calls
void CChainLocksHandler::EnforceBestChainLock()
{
if (!masternodeSync.IsBlockchainSynced()) {
return;
}

CChainLockSig clsig;
const CBlockIndex* pindex;
const CBlockIndex* currentBestChainLockBlockIndex;
Expand Down Expand Up @@ -594,6 +604,10 @@ bool CChainLocksHandler::InternalHasConflictingChainLock(int nHeight, const uint

void CChainLocksHandler::Cleanup()
{
if (!masternodeSync.IsBlockchainSynced()) {
return;
}

{
LOCK(cs);
if (GetTimeMillis() - lastCleanupTime < CLEANUP_INTERVAL) {
Expand Down

0 comments on commit f642489

Please sign in to comment.