mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
refactor: use signing helper function instead of passing blsKeyOperator
This commit is contained in:
parent
33702aca39
commit
1b516ce4ed
@ -698,8 +698,8 @@ std::optional<const CGovernanceObject> CGovernanceManager::CreateGovernanceTrigg
|
|||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
gov_sb.SetMasternodeOutpoint(::activeMasternodeManager->m_info.outpoint);
|
gov_sb.SetMasternodeOutpoint(::activeMasternodeManager->m_info.outpoint);
|
||||||
gov_sb.Sign( *::activeMasternodeManager->m_info.blsKeyOperator);
|
|
||||||
} // ::activeMasternodeManager->cs
|
} // ::activeMasternodeManager->cs
|
||||||
|
gov_sb.Sign(*::activeMasternodeManager);
|
||||||
|
|
||||||
if (std::string strError; !gov_sb.IsValidLocally(m_dmnman->GetListAtChainTip(), strError, true)) {
|
if (std::string strError; !gov_sb.IsValidLocally(m_dmnman->GetListAtChainTip(), strError, true)) {
|
||||||
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s Created trigger is invalid:%s\n", __func__, strError);
|
LogPrint(BCLog::GOBJECT, "CGovernanceManager::%s Created trigger is invalid:%s\n", __func__, strError);
|
||||||
@ -765,7 +765,7 @@ bool CGovernanceManager::VoteFundingTrigger(const uint256& nHash, const vote_out
|
|||||||
{
|
{
|
||||||
CGovernanceVote vote(WITH_LOCK(::activeMasternodeManager->cs, return ::activeMasternodeManager->m_info.outpoint), nHash, VOTE_SIGNAL_FUNDING, outcome);
|
CGovernanceVote vote(WITH_LOCK(::activeMasternodeManager->cs, return ::activeMasternodeManager->m_info.outpoint), nHash, VOTE_SIGNAL_FUNDING, outcome);
|
||||||
vote.SetTime(GetAdjustedTime());
|
vote.SetTime(GetAdjustedTime());
|
||||||
vote.Sign(WITH_LOCK(::activeMasternodeManager->cs, return *::activeMasternodeManager->m_info.blsKeyOperator));
|
vote.Sign(*::activeMasternodeManager);
|
||||||
|
|
||||||
CGovernanceException exception;
|
CGovernanceException exception;
|
||||||
if (!ProcessVoteAndRelay(vote, exception, connman)) {
|
if (!ProcessVoteAndRelay(vote, exception, connman)) {
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <governance/governance.h>
|
#include <governance/governance.h>
|
||||||
#include <governance/validators.h>
|
#include <governance/validators.h>
|
||||||
#include <masternode/meta.h>
|
#include <masternode/meta.h>
|
||||||
|
#include <masternode/node.h>
|
||||||
#include <masternode/sync.h>
|
#include <masternode/sync.h>
|
||||||
#include <messagesigner.h>
|
#include <messagesigner.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
@ -273,9 +274,9 @@ void CGovernanceObject::SetMasternodeOutpoint(const COutPoint& outpoint)
|
|||||||
m_obj.masternodeOutpoint = outpoint;
|
m_obj.masternodeOutpoint = outpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGovernanceObject::Sign(const CBLSSecretKey& key)
|
bool CGovernanceObject::Sign(const CActiveMasternodeManager& mn_activeman)
|
||||||
{
|
{
|
||||||
CBLSSignature sig = key.Sign(GetSignatureHash(), false);
|
CBLSSignature sig = mn_activeman.Sign(GetSignatureHash(), false);
|
||||||
if (!sig.IsValid()) {
|
if (!sig.IsValid()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <univalue.h>
|
#include <univalue.h>
|
||||||
|
|
||||||
class CBLSSecretKey;
|
class CActiveMasternodeManager;
|
||||||
class CBLSPublicKey;
|
class CBLSPublicKey;
|
||||||
class CDeterministicMNList;
|
class CDeterministicMNList;
|
||||||
class CGovernanceManager;
|
class CGovernanceManager;
|
||||||
@ -217,7 +217,7 @@ public:
|
|||||||
// Signature related functions
|
// Signature related functions
|
||||||
|
|
||||||
void SetMasternodeOutpoint(const COutPoint& outpoint);
|
void SetMasternodeOutpoint(const COutPoint& outpoint);
|
||||||
bool Sign(const CBLSSecretKey& key);
|
bool Sign(const CActiveMasternodeManager& mn_activeman);
|
||||||
bool CheckSignature(const CBLSPublicKey& pubKey) const;
|
bool CheckSignature(const CBLSPublicKey& pubKey) const;
|
||||||
|
|
||||||
uint256 GetSignatureHash() const;
|
uint256 GetSignatureHash() const;
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <bls/bls.h>
|
#include <bls/bls.h>
|
||||||
#include <chainparams.h>
|
#include <chainparams.h>
|
||||||
#include <key.h>
|
#include <key.h>
|
||||||
|
#include <masternode/node.h>
|
||||||
#include <masternode/sync.h>
|
#include <masternode/sync.h>
|
||||||
#include <messagesigner.h>
|
#include <messagesigner.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
@ -221,9 +222,9 @@ bool CGovernanceVote::CheckSignature(const CKeyID& keyID) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGovernanceVote::Sign(const CBLSSecretKey& key)
|
bool CGovernanceVote::Sign(const CActiveMasternodeManager& mn_activeman)
|
||||||
{
|
{
|
||||||
CBLSSignature sig = key.Sign(GetSignatureHash(), false);
|
CBLSSignature sig = mn_activeman.Sign(GetSignatureHash(), false);
|
||||||
if (!sig.IsValid()) {
|
if (!sig.IsValid()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
#include <primitives/transaction.h>
|
#include <primitives/transaction.h>
|
||||||
#include <uint256.h>
|
#include <uint256.h>
|
||||||
|
|
||||||
class CGovernanceVote;
|
class CActiveMasternodeManager;
|
||||||
class CBLSPublicKey;
|
class CBLSPublicKey;
|
||||||
class CBLSSecretKey;
|
|
||||||
class CConnman;
|
class CConnman;
|
||||||
class CDeterministicMNList;
|
class CDeterministicMNList;
|
||||||
|
class CGovernanceVote;
|
||||||
class CKey;
|
class CKey;
|
||||||
class CKeyID;
|
class CKeyID;
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ public:
|
|||||||
|
|
||||||
bool Sign(const CKey& key, const CKeyID& keyID);
|
bool Sign(const CKey& key, const CKeyID& keyID);
|
||||||
bool CheckSignature(const CKeyID& keyID) const;
|
bool CheckSignature(const CKeyID& keyID) const;
|
||||||
bool Sign(const CBLSSecretKey& key);
|
bool Sign(const CActiveMasternodeManager& mn_activeman);
|
||||||
bool CheckSignature(const CBLSPublicKey& pubKey) const;
|
bool CheckSignature(const CBLSPublicKey& pubKey) const;
|
||||||
bool IsValid(const CDeterministicMNList& tip_mn_list, bool useVotingKey) const;
|
bool IsValid(const CDeterministicMNList& tip_mn_list, bool useVotingKey) const;
|
||||||
void Relay(CConnman& connman, const CDeterministicMNList& tip_mn_list) const;
|
void Relay(CConnman& connman, const CDeterministicMNList& tip_mn_list) const;
|
||||||
|
@ -93,7 +93,7 @@ EXPECTED_CIRCULAR_DEPENDENCIES=(
|
|||||||
"spork -> validation -> spork"
|
"spork -> validation -> spork"
|
||||||
"governance/governance -> validation -> governance/governance"
|
"governance/governance -> validation -> governance/governance"
|
||||||
"evo/deterministicmns -> validationinterface -> governance/vote -> evo/deterministicmns"
|
"evo/deterministicmns -> validationinterface -> governance/vote -> evo/deterministicmns"
|
||||||
"governance/vote -> validation -> validationinterface -> governance/vote"
|
"governance/vote -> masternode/node -> validationinterface -> governance/vote"
|
||||||
"llmq/signing -> masternode/node -> validationinterface -> llmq/signing"
|
"llmq/signing -> masternode/node -> validationinterface -> llmq/signing"
|
||||||
"evo/mnhftx -> validation -> evo/mnhftx"
|
"evo/mnhftx -> validation -> evo/mnhftx"
|
||||||
"evo/deterministicmns -> validation -> evo/deterministicmns"
|
"evo/deterministicmns -> validation -> evo/deterministicmns"
|
||||||
|
Loading…
Reference in New Issue
Block a user