Skip to content

Commit b152759

Browse files
committed
refactor: remove fMasternodeMode and fDisableGovernance from Qt code
1 parent 9402ce7 commit b152759

4 files changed

Lines changed: 17 additions & 2 deletions

File tree

src/interfaces/node.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class GOV
6565
virtual void getAllNewerThan(std::vector<CGovernanceObject> &objs, int64_t nMoreThanTime) = 0;
6666
virtual int32_t getObjAbsYesCount(const CGovernanceObject& obj, vote_signal_enum_t vote_signal) = 0;
6767
virtual bool getObjLocalValidity(const CGovernanceObject& obj, std::string& error, bool check_collateral) = 0;
68+
virtual bool isEnabled() = 0;
6869
virtual void setContext(NodeContext* context) {}
6970
};
7071

@@ -230,6 +231,9 @@ class Node
230231
//! Is initial block download.
231232
virtual bool isInitialBlockDownload() = 0;
232233

234+
//! Is masternode.
235+
virtual bool isMasternode() = 0;
236+
233237
//! Get reindex.
234238
virtual bool getReindex() = 0;
235239

src/node/interfaces.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ class GOVImpl : public GOV
133133
}
134134
return false;
135135
}
136+
bool isEnabled() override
137+
{
138+
if (context().govman != nullptr) {
139+
return context().govman->IsValid();
140+
}
141+
return false;
142+
}
136143
void setContext(NodeContext* context) override
137144
{
138145
m_context = context;
@@ -477,6 +484,10 @@ class NodeImpl : public Node
477484
}
478485
return active_chainstate->IsInitialBlockDownload();
479486
}
487+
bool isMasternode() override
488+
{
489+
return m_context->mn_activeman != nullptr;
490+
}
480491
bool getReindex() override { return ::fReindex; }
481492
bool getImporting() override { return ::fImporting; }
482493
void setNetworkActive(bool active) override

src/qt/bitcoingui.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1483,7 +1483,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, const QStri
14831483
tooltip += tr("Last received block was generated %1 ago.").arg(timeBehindText);
14841484
tooltip += QString("<br>");
14851485
tooltip += tr("Transactions after this will not yet be visible.");
1486-
} else if (fDisableGovernance) {
1486+
} else if (!m_node.gov().isEnabled()) {
14871487
setAdditionalDataSyncProgress(1);
14881488
}
14891489

src/qt/overviewpage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ void OverviewPage::coinJoinStatus(bool fForce)
474474
if (!fForce && (clientModel->node().shutdownRequested() || !clientModel->masternodeSync().isBlockchainSynced())) return;
475475

476476
// Disable any PS UI for masternode or when autobackup is disabled or failed for whatever reason
477-
if (fMasternodeMode || nWalletBackups <= 0) {
477+
if (clientModel->node().isMasternode() || nWalletBackups <= 0) {
478478
DisableCoinJoinCompletely();
479479
if (nWalletBackups <= 0) {
480480
ui->labelCoinJoinEnabled->setToolTip(tr("Automatic backups are disabled, no mixing available!"));

0 commit comments

Comments
 (0)