mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
refactor: new method to generate a signing message in CGovernanceVote
This commit is contained in:
parent
6e5d3f1d1f
commit
490832959d
@ -208,12 +208,7 @@ bool CGovernanceVote::CheckSignature(const CKeyID& keyID) const
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
std::string strMessage = masternodeOutpoint.ToStringShort() + "|" + nParentHash.ToString() + "|" +
|
||||
::ToString(nVoteSignal) + "|" +
|
||||
::ToString(nVoteOutcome) + "|" +
|
||||
::ToString(nTime);
|
||||
|
||||
if (!CMessageSigner::VerifyMessage(keyID, vchSig, strMessage, strError)) {
|
||||
if (!CMessageSigner::VerifyMessage(keyID, vchSig, GetSignatureString(), strError)) {
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceVote::IsValid -- VerifyMessage() failed, error: %s\n", strError);
|
||||
return false;
|
||||
}
|
||||
@ -275,6 +270,14 @@ 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)
|
||||
{
|
||||
bool fResult = ((vote1.masternodeOutpoint == vote2.masternodeOutpoint) &&
|
||||
|
@ -105,6 +105,7 @@ public:
|
||||
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;
|
||||
void Relay(PeerManager& peerman, const CMasternodeSync& mn_sync, const CDeterministicMNList& tip_mn_list) const;
|
||||
|
||||
const COutPoint& GetMasternodeOutpoint() const { return masternodeOutpoint; }
|
||||
|
Loading…
Reference in New Issue
Block a user