@@ -221,7 +221,7 @@ void CQuorumManager::Stop()
221
221
222
222
void CQuorumManager::TriggerQuorumDataRecoveryThreads (const CBlockIndex* pIndex) const
223
223
{
224
- if (!fMasternodeMode || !utils::QuorumDataRecoveryEnabled () || pIndex == nullptr ) {
224
+ if (( !fMasternodeMode && ! utils::IsWatchQuorumsEnabled ()) || !utils::QuorumDataRecoveryEnabled () || pIndex == nullptr ) {
225
225
return ;
226
226
}
227
227
@@ -272,15 +272,13 @@ void CQuorumManager::TriggerQuorumDataRecoveryThreads(const CBlockIndex* pIndex)
272
272
273
273
void CQuorumManager::UpdatedBlockTip (const CBlockIndex* pindexNew, bool fInitialDownload ) const
274
274
{
275
- if (!m_mn_sync->IsBlockchainSynced ()) {
276
- return ;
277
- }
275
+ if (!m_mn_sync->IsBlockchainSynced ()) return ;
278
276
279
277
for (const auto & params : Params ().GetConsensus ().llmqs ) {
280
278
CheckQuorumConnections (params, pindexNew);
281
279
}
282
280
283
- {
281
+ if ( fMasternodeMode || utils::IsWatchQuorumsEnabled ()) {
284
282
// Cleanup expired data requests
285
283
LOCK (cs_data_requests);
286
284
auto it = mapQuorumDataRequests.begin ();
@@ -299,6 +297,8 @@ void CQuorumManager::UpdatedBlockTip(const CBlockIndex* pindexNew, bool fInitial
299
297
300
298
void CQuorumManager::CheckQuorumConnections (const Consensus::LLMQParams& llmqParams, const CBlockIndex* pindexNew) const
301
299
{
300
+ if (!fMasternodeMode && !utils::IsWatchQuorumsEnabled ()) return ;
301
+
302
302
auto lastQuorums = ScanQuorums (llmqParams.type , pindexNew, (size_t )llmqParams.keepOldConnections );
303
303
304
304
auto connmanQuorumsToDelete = connman.GetMasternodeQuorums (llmqParams.type );
@@ -450,8 +450,8 @@ bool CQuorumManager::RequestQuorumData(CNode* pfrom, Consensus::LLMQType llmqTyp
450
450
LogPrint (BCLog::LLMQ, " CQuorumManager::%s -- Version must be %d or greater.\n " , __func__, LLMQ_DATA_MESSAGES_VERSION);
451
451
return false ;
452
452
}
453
- if (pfrom->GetVerifiedProRegTxHash ().IsNull () && !pfrom-> qwatch ) {
454
- LogPrint (BCLog::LLMQ, " CQuorumManager::%s -- pfrom is neither a verified masternode nor a qwatch connection \n " , __func__);
453
+ if (pfrom->GetVerifiedProRegTxHash ().IsNull ()) {
454
+ LogPrint (BCLog::LLMQ, " CQuorumManager::%s -- pfrom is not a verified masternode\n " , __func__);
455
455
return false ;
456
456
}
457
457
if (!GetLLMQParams (llmqType).has_value ()) {
@@ -470,8 +470,8 @@ bool CQuorumManager::RequestQuorumData(CNode* pfrom, Consensus::LLMQType llmqTyp
470
470
LOCK (cs_data_requests);
471
471
const CQuorumDataRequestKey key (pfrom->GetVerifiedProRegTxHash (), true , pQuorumBaseBlockIndex->GetBlockHash (), llmqType);
472
472
const CQuorumDataRequest request (llmqType, pQuorumBaseBlockIndex->GetBlockHash (), nDataMask, proTxHash);
473
- auto [old_pair, exists ] = mapQuorumDataRequests.emplace (key, request);
474
- if (!exists ) {
473
+ auto [old_pair, inserted ] = mapQuorumDataRequests.emplace (key, request);
474
+ if (!inserted ) {
475
475
if (old_pair->second .IsExpired (/* add_bias=*/ true )) {
476
476
old_pair->second = request;
477
477
} else {
@@ -752,8 +752,8 @@ void CQuorumManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, C
752
752
}
753
753
754
754
if (msg_type == NetMsgType::QDATA) {
755
- if ((!fMasternodeMode && !utils::IsWatchQuorumsEnabled ()) || ( pfrom.GetVerifiedProRegTxHash ().IsNull () && !pfrom. qwatch )) {
756
- errorHandler (" Not a verified masternode or a qwatch connection " );
755
+ if ((!fMasternodeMode && !utils::IsWatchQuorumsEnabled ()) || pfrom.GetVerifiedProRegTxHash ().IsNull ()) {
756
+ errorHandler (" Not a verified masternode and -watchquorums is not enabled " );
757
757
return ;
758
758
}
759
759
@@ -1051,7 +1051,7 @@ void CQuorumManager::StartCleanupOldQuorumDataThread(const CBlockIndex* pIndex)
1051
1051
// window and it's better to have more room so we pick next cycle.
1052
1052
// dkgMiningWindowStart for small quorums is 10 i.e. a safe block to start
1053
1053
// these calculations is at height 576 + 24 * 2 + 10 = 576 + 58.
1054
- if (!fMasternodeMode || pIndex == nullptr || (pIndex->nHeight % 576 != 58 )) {
1054
+ if (( !fMasternodeMode && ! utils::IsWatchQuorumsEnabled ()) || pIndex == nullptr || (pIndex->nHeight % 576 != 58 )) {
1055
1055
return ;
1056
1056
}
1057
1057
0 commit comments