@@ -221,7 +221,7 @@ void CQuorumManager::Stop()
221221
222222void CQuorumManager::TriggerQuorumDataRecoveryThreads (const CBlockIndex* pIndex) const
223223{
224- if (!fMasternodeMode || !utils::QuorumDataRecoveryEnabled () || pIndex == nullptr ) {
224+ if (( !fMasternodeMode && ! utils::IsWatchQuorumsEnabled ()) || !utils::QuorumDataRecoveryEnabled () || pIndex == nullptr ) {
225225 return ;
226226 }
227227
@@ -272,15 +272,13 @@ void CQuorumManager::TriggerQuorumDataRecoveryThreads(const CBlockIndex* pIndex)
272272
273273void CQuorumManager::UpdatedBlockTip (const CBlockIndex* pindexNew, bool fInitialDownload ) const
274274{
275- if (!m_mn_sync->IsBlockchainSynced ()) {
276- return ;
277- }
275+ if (!m_mn_sync->IsBlockchainSynced ()) return ;
278276
279277 for (const auto & params : Params ().GetConsensus ().llmqs ) {
280278 CheckQuorumConnections (params, pindexNew);
281279 }
282280
283- {
281+ if ( fMasternodeMode || utils::IsWatchQuorumsEnabled ()) {
284282 // Cleanup expired data requests
285283 LOCK (cs_data_requests);
286284 auto it = mapQuorumDataRequests.begin ();
@@ -299,6 +297,8 @@ void CQuorumManager::UpdatedBlockTip(const CBlockIndex* pindexNew, bool fInitial
299297
300298void CQuorumManager::CheckQuorumConnections (const Consensus::LLMQParams& llmqParams, const CBlockIndex* pindexNew) const
301299{
300+ if (!fMasternodeMode && !utils::IsWatchQuorumsEnabled ()) return ;
301+
302302 auto lastQuorums = ScanQuorums (llmqParams.type , pindexNew, (size_t )llmqParams.keepOldConnections );
303303
304304 auto connmanQuorumsToDelete = connman.GetMasternodeQuorums (llmqParams.type );
@@ -450,8 +450,8 @@ bool CQuorumManager::RequestQuorumData(CNode* pfrom, Consensus::LLMQType llmqTyp
450450 LogPrint (BCLog::LLMQ, " CQuorumManager::%s -- Version must be %d or greater.\n " , __func__, LLMQ_DATA_MESSAGES_VERSION);
451451 return false ;
452452 }
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__);
455455 return false ;
456456 }
457457 if (!GetLLMQParams (llmqType).has_value ()) {
@@ -470,8 +470,8 @@ bool CQuorumManager::RequestQuorumData(CNode* pfrom, Consensus::LLMQType llmqTyp
470470 LOCK (cs_data_requests);
471471 const CQuorumDataRequestKey key (pfrom->GetVerifiedProRegTxHash (), true , pQuorumBaseBlockIndex->GetBlockHash (), llmqType);
472472 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 ) {
475475 if (old_pair->second .IsExpired (/* add_bias=*/ true )) {
476476 old_pair->second = request;
477477 } else {
@@ -752,8 +752,8 @@ void CQuorumManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, C
752752 }
753753
754754 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 " );
757757 return ;
758758 }
759759
@@ -1051,7 +1051,7 @@ void CQuorumManager::StartCleanupOldQuorumDataThread(const CBlockIndex* pIndex)
10511051 // window and it's better to have more room so we pick next cycle.
10521052 // dkgMiningWindowStart for small quorums is 10 i.e. a safe block to start
10531053 // 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 )) {
10551055 return ;
10561056 }
10571057
0 commit comments