mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +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;
|
||||
}
|
||||
gov_sb.SetMasternodeOutpoint(::activeMasternodeManager->m_info.outpoint);
|
||||
gov_sb.Sign( *::activeMasternodeManager->m_info.blsKeyOperator);
|
||||
} // ::activeMasternodeManager->cs
|
||||
gov_sb.Sign(*::activeMasternodeManager);
|
||||
|
||||
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);
|
||||
@ -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);
|
||||
vote.SetTime(GetAdjustedTime());
|
||||
vote.Sign(WITH_LOCK(::activeMasternodeManager->cs, return *::activeMasternodeManager->m_info.blsKeyOperator));
|
||||
vote.Sign(*::activeMasternodeManager);
|
||||
|
||||
CGovernanceException exception;
|
||||
if (!ProcessVoteAndRelay(vote, exception, connman)) {
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <governance/governance.h>
|
||||
#include <governance/validators.h>
|
||||
#include <masternode/meta.h>
|
||||
#include <masternode/node.h>
|
||||
#include <masternode/sync.h>
|
||||
#include <messagesigner.h>
|
||||
#include <net.h>
|
||||
@ -273,9 +274,9 @@ void CGovernanceObject::SetMasternodeOutpoint(const COutPoint& 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()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#include <univalue.h>
|
||||
|
||||
class CBLSSecretKey;
|
||||
class CActiveMasternodeManager;
|
||||
class CBLSPublicKey;
|
||||
class CDeterministicMNList;
|
||||
class CGovernanceManager;
|
||||
@ -217,7 +217,7 @@ public:
|
||||
// Signature related functions
|
||||
|
||||
void SetMasternodeOutpoint(const COutPoint& outpoint);
|
||||
bool Sign(const CBLSSecretKey& key);
|
||||
bool Sign(const CActiveMasternodeManager& mn_activeman);
|
||||
bool CheckSignature(const CBLSPublicKey& pubKey) const;
|
||||
|
||||
uint256 GetSignatureHash() const;
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <bls/bls.h>
|
||||
#include <chainparams.h>
|
||||
#include <key.h>
|
||||
#include <masternode/node.h>
|
||||
#include <masternode/sync.h>
|
||||
#include <messagesigner.h>
|
||||
#include <net.h>
|
||||
@ -221,9 +222,9 @@ bool CGovernanceVote::CheckSignature(const CKeyID& keyID) const
|
||||
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()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -8,11 +8,11 @@
|
||||
#include <primitives/transaction.h>
|
||||
#include <uint256.h>
|
||||
|
||||
class CGovernanceVote;
|
||||
class CActiveMasternodeManager;
|
||||
class CBLSPublicKey;
|
||||
class CBLSSecretKey;
|
||||
class CConnman;
|
||||
class CDeterministicMNList;
|
||||
class CGovernanceVote;
|
||||
class CKey;
|
||||
class CKeyID;
|
||||
|
||||
@ -101,7 +101,7 @@ public:
|
||||
|
||||
bool Sign(const CKey& key, const CKeyID& keyID);
|
||||
bool CheckSignature(const CKeyID& keyID) const;
|
||||
bool Sign(const CBLSSecretKey& key);
|
||||
bool Sign(const CActiveMasternodeManager& mn_activeman);
|
||||
bool CheckSignature(const CBLSPublicKey& pubKey) const;
|
||||
bool IsValid(const CDeterministicMNList& tip_mn_list, bool useVotingKey) const;
|
||||
void Relay(CConnman& connman, const CDeterministicMNList& tip_mn_list) const;
|
||||
|
@ -93,7 +93,7 @@ EXPECTED_CIRCULAR_DEPENDENCIES=(
|
||||
"spork -> validation -> spork"
|
||||
"governance/governance -> validation -> governance/governance"
|
||||
"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"
|
||||
"evo/mnhftx -> validation -> evo/mnhftx"
|
||||
"evo/deterministicmns -> validation -> evo/deterministicmns"
|
||||
|
Loading…
Reference in New Issue
Block a user