Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/release-notes/release-notes-6690.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
GUI changes
-----------

- Added governance proposal voting functionality to the Qt interface. Users with masternode voting keys can now vote on governance proposals directly from the governance tab via right-click context menu (#6690).
- Added masternode count display to governance tab showing how many masternodes the wallet can vote with (#6690).
11 changes: 0 additions & 11 deletions src/governance/vote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ uint256 CGovernanceVote::GetHash() const
return hash;
}

uint256 CGovernanceVote::GetSignatureHash() const
{
return SerializeHash(*this);
}

bool CGovernanceVote::CheckSignature(const CKeyID& keyID) const
{
Expand Down Expand Up @@ -218,13 +214,6 @@ bool CGovernanceVote::IsValid(const CDeterministicMNList& tip_mn_list, bool useV
}
}

std::string CGovernanceVote::GetSignatureString() const
{
return masternodeOutpoint.ToStringShort() + "|" + nParentHash.ToString() + "|" +
::ToString(nVoteSignal) + "|" +
::ToString(nVoteOutcome) + "|" +
::ToString(nTime);
}

bool operator==(const CGovernanceVote& vote1, const CGovernanceVote& vote2)
{
Expand Down
20 changes: 18 additions & 2 deletions src/governance/vote.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
#ifndef BITCOIN_GOVERNANCE_VOTE_H
#define BITCOIN_GOVERNANCE_VOTE_H

#include <hash.h>
#include <primitives/transaction.h>
#include <uint256.h>
#include <util/string.h>

class CActiveMasternodeManager;
class CBLSPublicKey;
Expand Down Expand Up @@ -100,7 +102,13 @@ class CGovernanceVote
bool Sign(const CActiveMasternodeManager& mn_activeman);
bool CheckSignature(const CBLSPublicKey& pubKey) const;
bool IsValid(const CDeterministicMNList& tip_mn_list, bool useVotingKey) const;
std::string GetSignatureString() const;
std::string GetSignatureString() const
{
return masternodeOutpoint.ToStringShort() + "|" + nParentHash.ToString() + "|" +
::ToString(nVoteSignal) + "|" +
::ToString(nVoteOutcome) + "|" +
::ToString(nTime);
}
void Relay(PeerManager& peerman, const CMasternodeSync& mn_sync, const CDeterministicMNList& tip_mn_list) const;

const COutPoint& GetMasternodeOutpoint() const { return masternodeOutpoint; }
Expand All @@ -112,7 +120,10 @@ class CGovernanceVote
*/

uint256 GetHash() const;
uint256 GetSignatureHash() const;
uint256 GetSignatureHash() const
{
return SerializeHash(*this);
}

std::string ToString(const CDeterministicMNList& tip_mn_list) const;

Expand All @@ -126,4 +137,9 @@ class CGovernanceVote
}
};

/**
* Sign a governance vote using wallet signing methods
* Handles different signing approaches for different networks
*/

#endif // BITCOIN_GOVERNANCE_VOTE_H
2 changes: 2 additions & 0 deletions src/interfaces/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class CBlockIndex;
class CDeterministicMNList;
class CFeeRate;
class CGovernanceObject;
class CGovernanceVote;
class CNodeStats;
class Coin;
class RPCTimerInterface;
Expand Down Expand Up @@ -70,6 +71,7 @@ class GOV
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 bool processVoteAndRelay(const CGovernanceVote& vote, std::string& error) = 0;
virtual void setContext(node::NodeContext* context) {}
};

Expand Down
3 changes: 3 additions & 0 deletions src/interfaces/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ class Wallet
//! Sign message
virtual SigningResult signMessage(const std::string& message, const PKHash& pkhash, std::string& str_sig) = 0;

//! Sign special transaction payload
virtual bool signSpecialTxPayload(const uint256& hash, const CKeyID& keyid, std::vector<unsigned char>& vchSig) = 0;

//! Return whether wallet has private key.
virtual bool isSpendable(const CScript& script) = 0;
virtual bool isSpendable(const CTxDestination& dest) = 0;
Expand Down
15 changes: 15 additions & 0 deletions src/node/interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
#include <coinjoin/common.h>
#include <deploymentstatus.h>
#include <evo/deterministicmns.h>
#include <governance/exceptions.h>
#include <governance/governance.h>
#include <governance/object.h>
#include <governance/vote.h>
#include <init.h>
#include <interfaces/chain.h>
#include <interfaces/coinjoin.h>
Expand Down Expand Up @@ -140,6 +142,19 @@ class GOVImpl : public GOV
}
return false;
}
bool processVoteAndRelay(const CGovernanceVote& vote, std::string& error) override
{
if (context().govman != nullptr && context().connman != nullptr && context().peerman != nullptr) {
CGovernanceException exception;
bool result = context().govman->ProcessVoteAndRelay(vote, exception, *context().connman, *context().peerman);
if (!result) {
error = exception.GetMessage();
}
return result;
}
error = "Governance manager not available";
return false;
}
void setContext(NodeContext* context) override
{
m_context = context;
Expand Down
38 changes: 37 additions & 1 deletion src/qt/forms/governancelist.ui
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,45 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_mn_count">
<property name="text">
<string>Masternode Count:</string>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add hint with some explanation of what this count for?

</property>
<property name="toolTip">
<string>Number of masternodes this wallet can vote with (masternodes for which this wallet holds the voting key)</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="mnCountLabel">
<property name="text">
<string notr="true">0</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<width>20</width>
<height>20</height>
</size>
</property>
Expand Down
Loading
Loading