diff --git a/src/interfaces/node.h b/src/interfaces/node.h index 3a4d59d55b29..b6fbef3de525 100644 --- a/src/interfaces/node.h +++ b/src/interfaces/node.h @@ -146,6 +146,7 @@ class GOV int nextsuperblock{0}; int fundingthreshold{0}; CAmount governancebudget{0}; + int64_t targetSpacing{0}; int relayRequiredConfs{1}; int requiredConfs{6}; }; diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h index 8c79ec01ca98..11e1cda99978 100644 --- a/src/interfaces/wallet.h +++ b/src/interfaces/wallet.h @@ -27,6 +27,7 @@ #include class CFeeRate; +class CGovernanceVote; class CKey; class CRPCCommand; enum class FeeReason; @@ -355,6 +356,9 @@ class Wallet const std::string& data_hex, const COutPoint& outpoint, std::string& out_fee_txid, std::string& error) = 0; + //! Sign a governance vote with the given voting key. + virtual bool signGovernanceVote(const CKeyID& keyID, CGovernanceVote& vote) = 0; + //! Return pointer to internal wallet class, useful for testing. virtual wallet::CWallet* wallet() { return nullptr; } }; diff --git a/src/net.cpp b/src/net.cpp index 4467507f68e0..3b70ee45fe00 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -4200,6 +4200,7 @@ void CConnman::StopNodes() } m_nodes_disconnected.clear(); vhListenSocket.clear(); + WITH_LOCK(m_reconnections_mutex, m_reconnections.clear()); semOutbound.reset(); semAddnode.reset(); /** diff --git a/src/net.h b/src/net.h index 6a742647ac0b..8bdda43e9e75 100644 --- a/src/net.h +++ b/src/net.h @@ -1261,8 +1261,8 @@ friend class CNode; EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex, !m_added_nodes_mutex, !m_addr_fetches_mutex, !mutexMsgProc); void StopThreads(); - void StopNodes() EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex, !cs_mapSocketToNode, !cs_sendable_receivable_nodes); - void Stop() EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex, !cs_mapSocketToNode, !cs_sendable_receivable_nodes) + void StopNodes() EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex, !cs_mapSocketToNode, !cs_sendable_receivable_nodes, !m_reconnections_mutex); + void Stop() EXCLUSIVE_LOCKS_REQUIRED(!m_nodes_mutex, !cs_mapSocketToNode, !cs_sendable_receivable_nodes, !m_reconnections_mutex) { StopThreads(); StopNodes(); diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index 1213e1380666..018739f399da 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -282,6 +282,7 @@ class GOVImpl : public GOV info.proposalfee = GOVERNANCE_PROPOSAL_FEE_TX; info.superblockcycle = consensusParams.nSuperblockCycle; info.superblockmaturitywindow = consensusParams.nSuperblockMaturityWindow; + info.targetSpacing = consensusParams.nPowTargetSpacing; info.relayRequiredConfs = GOVERNANCE_MIN_RELAY_FEE_CONFIRMATIONS; info.requiredConfs = GOVERNANCE_FEE_CONFIRMATIONS; if (ctx.dmnman) { @@ -366,7 +367,7 @@ class LLMQImpl : public LLMQ public: size_t getInstantSentLockCount() override { - if (context().llmq_ctx->isman != nullptr) { + if (context().llmq_ctx && context().llmq_ctx->isman != nullptr) { return context().llmq_ctx->isman->GetInstantSendLockCount(); } return 0; diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index b1acc667ba32..dc5055a089c5 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1476,7 +1476,14 @@ void BitcoinGUI::updateGovernanceVisibility() // Show/hide the underlying QAction, hiding the QToolButton itself doesn't // work for the GUI part but is still needed for shortcuts to work properly. if (m_governance_action) m_governance_action->setVisible(fShow); - if (governanceButton) governanceButton->setVisible(fShow); + if (governanceButton) { +#ifdef ENABLE_WALLET + if (!fShow && governanceButton->isChecked()) { + gotoOverviewPage(); + } +#endif // ENABLE_WALLET + governanceButton->setVisible(fShow); + } GUIUtil::updateButtonGroupShortcuts(tabGroup); updateWidth(); @@ -1490,7 +1497,14 @@ void BitcoinGUI::updateMasternodesVisibility() // Show/hide the underlying QAction, hiding the QToolButton itself doesn't // work for the GUI part but is still needed for shortcuts to work properly. if (m_masternode_action) m_masternode_action->setVisible(fShow); - if (masternodeButton) masternodeButton->setVisible(fShow); + if (masternodeButton) { +#ifdef ENABLE_WALLET + if (!fShow && masternodeButton->isChecked()) { + gotoOverviewPage(); + } +#endif // ENABLE_WALLET + masternodeButton->setVisible(fShow); + } GUIUtil::updateButtonGroupShortcuts(tabGroup); updateWidth(); @@ -1507,7 +1521,7 @@ void BitcoinGUI::updateWidth() int nWidthWidestButton{0}; int nButtonsVisible{0}; for (QAbstractButton* button : tabGroup->buttons()) { - if (!button->isEnabled()) { + if (!button->isEnabled() || !button->isVisible()) { continue; } QFontMetrics fm(button->font()); diff --git a/src/qt/governancelist.cpp b/src/qt/governancelist.cpp index f7b64ba1b2ee..ae560bc8ca32 100644 --- a/src/qt/governancelist.cpp +++ b/src/qt/governancelist.cpp @@ -18,7 +18,6 @@ #include #include