Skip to content

Commit dce46ad

Browse files
UdjinM6panleone
authored andcommitted
Bail out in few more places when blockchain is not synced yet (dashpay#2888)
* Bail out in few more places when blockchain is not synced yet * Apply review suggestion
1 parent 965a4a7 commit dce46ad

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/llmq/quorums.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "quorums_commitment.h"
1616
#include "quorums_dkgsessionmgr.h"
1717
#include "shutdown.h"
18+
#include "tiertwo/tiertwo_sync_state.h"
1819
#include "univalue.h"
1920
#include "validation.h"
2021

@@ -165,7 +166,7 @@ CQuorumManager::CQuorumManager(CEvoDB& _evoDb, CBLSWorker& _blsWorker, CDKGSessi
165166

166167
void CQuorumManager::UpdatedBlockTip(const CBlockIndex* pindexNew, bool fInitialDownload)
167168
{
168-
if (fInitialDownload || !activeMasternodeManager || !deterministicMNManager->IsDIP3Enforced(pindexNew->nHeight)) {
169+
if (!g_tiertwo_sync_state.IsBlockchainSynced() || !activeMasternodeManager) {
169170
return;
170171
}
171172

src/llmq/quorums_chainlocks.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "scheduler.h"
1414
#include "spork.h"
1515
#include "sporkid.h"
16+
#include "tiertwo/tiertwo_sync_state.h"
1617
#include "validation.h"
1718

1819
namespace llmq
@@ -207,15 +208,20 @@ void CChainLocksHandler::TrySignChainTip()
207208
{
208209
Cleanup();
209210

211+
if (!fMasterNode) {
212+
return;
213+
}
214+
215+
if (!g_tiertwo_sync_state.IsBlockchainSynced()) {
216+
return;
217+
}
218+
210219
const CBlockIndex* pindex;
211220
{
212221
LOCK(cs_main);
213222
pindex = chainActive.Tip();
214223
}
215224

216-
if (!fMasterNode) {
217-
return;
218-
}
219225
if (!pindex->pprev) {
220226
return;
221227
}
@@ -440,6 +446,10 @@ bool CChainLocksHandler::InternalHasConflictingChainLock(int nHeight, const uint
440446

441447
void CChainLocksHandler::Cleanup()
442448
{
449+
if (!g_tiertwo_sync_state.IsBlockchainSynced()) {
450+
return;
451+
}
452+
443453
{
444454
LOCK(cs);
445455
if (GetTimeMillis() - lastCleanupTime < CLEANUP_INTERVAL) {

0 commit comments

Comments
 (0)