Skip to content

Commit fbd244d

Browse files
authored
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
1 parent fd6aaae commit fbd244d

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/llmq/quorums.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "activemasternode.h"
1616
#include "chainparams.h"
1717
#include "init.h"
18+
#include "masternode-sync.h"
1819
#include "univalue.h"
1920
#include "validation.h"
2021

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

162163
void CQuorumManager::UpdatedBlockTip(const CBlockIndex* pindexNew, bool fInitialDownload)
163164
{
164-
if (fInitialDownload) {
165+
if (!masternodeSync.IsBlockchainSynced()) {
165166
return;
166167
}
167168

src/llmq/quorums_chainlocks.cpp

+13-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "quorums_utils.h"
1010

1111
#include "chain.h"
12+
#include "masternode-sync.h"
1213
#include "net_processing.h"
1314
#include "scheduler.h"
1415
#include "spork.h"
@@ -232,15 +233,20 @@ void CChainLocksHandler::TrySignChainTip()
232233
{
233234
Cleanup();
234235

236+
if (!fMasternodeMode) {
237+
return;
238+
}
239+
240+
if (!masternodeSync.IsBlockchainSynced()) {
241+
return;
242+
}
243+
235244
const CBlockIndex* pindex;
236245
{
237246
LOCK(cs_main);
238247
pindex = chainActive.Tip();
239248
}
240249

241-
if (!fMasternodeMode) {
242-
return;
243-
}
244250
if (!pindex->pprev) {
245251
return;
246252
}
@@ -594,6 +600,10 @@ bool CChainLocksHandler::InternalHasConflictingChainLock(int nHeight, const uint
594600

595601
void CChainLocksHandler::Cleanup()
596602
{
603+
if (!masternodeSync.IsBlockchainSynced()) {
604+
return;
605+
}
606+
597607
{
598608
LOCK(cs);
599609
if (GetTimeMillis() - lastCleanupTime < CLEANUP_INTERVAL) {

0 commit comments

Comments
 (0)