From b1527599e4e4ddd9b6d072b55e2e7f5ee6071409 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Thu, 18 Apr 2024 19:11:16 +0000 Subject: [PATCH] refactor: remove fMasternodeMode and fDisableGovernance from Qt code --- src/interfaces/node.h | 4 ++++ src/node/interfaces.cpp | 11 +++++++++++ src/qt/bitcoingui.cpp | 2 +- src/qt/overviewpage.cpp | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/interfaces/node.h b/src/interfaces/node.h index b7ed607644..374e4d0a95 100644 --- a/src/interfaces/node.h +++ b/src/interfaces/node.h @@ -65,6 +65,7 @@ public: virtual void getAllNewerThan(std::vector &objs, int64_t nMoreThanTime) = 0; virtual int32_t getObjAbsYesCount(const CGovernanceObject& obj, vote_signal_enum_t vote_signal) = 0; virtual bool getObjLocalValidity(const CGovernanceObject& obj, std::string& error, bool check_collateral) = 0; + virtual bool isEnabled() = 0; virtual void setContext(NodeContext* context) {} }; @@ -230,6 +231,9 @@ public: //! Is initial block download. virtual bool isInitialBlockDownload() = 0; + //! Is masternode. + virtual bool isMasternode() = 0; + //! Get reindex. virtual bool getReindex() = 0; diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index eff295d891..b4be01cde2 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -133,6 +133,13 @@ public: } return false; } + bool isEnabled() override + { + if (context().govman != nullptr) { + return context().govman->IsValid(); + } + return false; + } void setContext(NodeContext* context) override { m_context = context; @@ -477,6 +484,10 @@ public: } return active_chainstate->IsInitialBlockDownload(); } + bool isMasternode() override + { + return m_context->mn_activeman != nullptr; + } bool getReindex() override { return ::fReindex; } bool getImporting() override { return ::fImporting; } void setNetworkActive(bool active) override diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 80dbf3b8c1..aad4a786d6 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1483,7 +1483,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, const QStri tooltip += tr("Last received block was generated %1 ago.").arg(timeBehindText); tooltip += QString("
"); tooltip += tr("Transactions after this will not yet be visible."); - } else if (fDisableGovernance) { + } else if (!m_node.gov().isEnabled()) { setAdditionalDataSyncProgress(1); } diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index f5909083a2..e0a7945591 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -474,7 +474,7 @@ void OverviewPage::coinJoinStatus(bool fForce) if (!fForce && (clientModel->node().shutdownRequested() || !clientModel->masternodeSync().isBlockchainSynced())) return; // Disable any PS UI for masternode or when autobackup is disabled or failed for whatever reason - if (fMasternodeMode || nWalletBackups <= 0) { + if (clientModel->node().isMasternode() || nWalletBackups <= 0) { DisableCoinJoinCompletely(); if (nWalletBackups <= 0) { ui->labelCoinJoinEnabled->setToolTip(tr("Automatic backups are disabled, no mixing available!"));