mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
refactor: move GetListAtChainTip() calls out of CGovernanceVote
This commit is contained in:
parent
e9de972982
commit
da39b73f01
@ -119,6 +119,7 @@ PeerMsgRet CGovernanceManager::ProcessMessage(CNode& peer, CConnman& connman, st
|
||||
if (fDisableGovernance) return {};
|
||||
if (::masternodeSync == nullptr || !::masternodeSync->IsBlockchainSynced()) return {};
|
||||
|
||||
const auto tip_mn_list = deterministicMNManager->GetListAtChainTip();
|
||||
// ANOTHER USER IS ASKING US TO HELP THEM SYNC GOVERNANCE OBJECT DATA
|
||||
if (msg_type == NetMsgType::MNGOVERNANCESYNC) {
|
||||
// Ignore such requests until we are fully synced.
|
||||
@ -187,7 +188,7 @@ PeerMsgRet CGovernanceManager::ProcessMessage(CNode& peer, CConnman& connman, st
|
||||
// CHECK OBJECT AGAINST LOCAL BLOCKCHAIN
|
||||
|
||||
bool fMissingConfirmations = false;
|
||||
bool fIsValid = govobj.IsValidLocally(deterministicMNManager->GetListAtChainTip(), strError, fMissingConfirmations, true);
|
||||
bool fIsValid = govobj.IsValidLocally(tip_mn_list, strError, fMissingConfirmations, true);
|
||||
|
||||
if (fRateCheckBypassed && fIsValid && !MasternodeRateCheck(govobj, true)) {
|
||||
LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECT -- masternode rate check failed (after signature verification) - %s - (current block height %d)\n", strHash, nCachedBlockHeight);
|
||||
@ -228,13 +229,13 @@ PeerMsgRet CGovernanceManager::ProcessMessage(CNode& peer, CConnman& connman, st
|
||||
return {};
|
||||
}
|
||||
|
||||
LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECTVOTE -- Received vote: %s\n", vote.ToString());
|
||||
LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECTVOTE -- Received vote: %s\n", vote.ToString(tip_mn_list));
|
||||
|
||||
std::string strHash = nHash.ToString();
|
||||
|
||||
if (!AcceptVoteMessage(nHash)) {
|
||||
LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECTVOTE -- Received unrequested vote object: %s, hash: %s, peer = %d\n",
|
||||
vote.ToString(), strHash, peer.GetId());
|
||||
vote.ToString(tip_mn_list), strHash, peer.GetId());
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -242,7 +243,7 @@ PeerMsgRet CGovernanceManager::ProcessMessage(CNode& peer, CConnman& connman, st
|
||||
if (ProcessVote(&peer, vote, exception, connman)) {
|
||||
LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECTVOTE -- %s new\n", strHash);
|
||||
::masternodeSync->BumpAssetLastTime("MNGOVERNANCEOBJECTVOTE");
|
||||
vote.Relay(connman);
|
||||
vote.Relay(connman, tip_mn_list);
|
||||
} else {
|
||||
LogPrint(BCLog::GOBJECT, "MNGOVERNANCEOBJECTVOTE -- Rejected vote, error = %s\n", exception.what());
|
||||
if ((exception.GetNodePenalty() != 0) && ::masternodeSync->IsSynced()) {
|
||||
@ -263,14 +264,15 @@ void CGovernanceManager::CheckOrphanVotes(CGovernanceObject& govobj, CConnman& c
|
||||
ScopedLockBool guard(cs, fRateChecksEnabled, false);
|
||||
|
||||
int64_t nNow = GetAdjustedTime();
|
||||
const auto tip_mn_list = deterministicMNManager->GetListAtChainTip();
|
||||
for (const auto& pairVote : vecVotePairs) {
|
||||
bool fRemove = false;
|
||||
const CGovernanceVote& vote = pairVote.first;
|
||||
CGovernanceException e;
|
||||
if (pairVote.second < nNow) {
|
||||
fRemove = true;
|
||||
} else if (govobj.ProcessVote(*this, deterministicMNManager->GetListAtChainTip(), vote, e)) {
|
||||
vote.Relay(connman);
|
||||
} else if (govobj.ProcessVote(*this, tip_mn_list, vote, e)) {
|
||||
vote.Relay(connman, tip_mn_list);
|
||||
fRemove = true;
|
||||
}
|
||||
if (fRemove) {
|
||||
@ -880,13 +882,14 @@ void CGovernanceManager::SyncSingleObjVotes(CNode& peer, const uint256& nProp, c
|
||||
}
|
||||
|
||||
const auto& fileVotes = govobj.GetVoteFile();
|
||||
const auto tip_mn_list = deterministicMNManager->GetListAtChainTip();
|
||||
|
||||
for (const auto& vote : fileVotes.GetVotes()) {
|
||||
uint256 nVoteHash = vote.GetHash();
|
||||
|
||||
bool onlyVotingKeyAllowed = govobj.GetObjectType() == GovernanceObject::PROPOSAL && vote.GetSignal() == VOTE_SIGNAL_FUNDING;
|
||||
|
||||
if (filter.contains(nVoteHash) || !vote.IsValid(onlyVotingKeyAllowed)) {
|
||||
if (filter.contains(nVoteHash) || !vote.IsValid(tip_mn_list, onlyVotingKeyAllowed)) {
|
||||
continue;
|
||||
}
|
||||
peer.PushInventory(CInv(MSG_GOVERNANCE_OBJECT_VOTE, nVoteHash));
|
||||
@ -1551,7 +1554,7 @@ void CGovernanceManager::RemoveInvalidVotes()
|
||||
|
||||
for (const auto& outpoint : changedKeyMNs) {
|
||||
for (auto& p : mapObjects) {
|
||||
auto removed = p.second.RemoveInvalidVotes(outpoint);
|
||||
auto removed = p.second.RemoveInvalidVotes(tip_mn_list, outpoint);
|
||||
if (removed.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#ifndef BITCOIN_GOVERNANCE_GOVERNANCE_H
|
||||
#define BITCOIN_GOVERNANCE_GOVERNANCE_H
|
||||
|
||||
#include <evo/deterministicmns.h>
|
||||
#include <governance/classes.h>
|
||||
#include <governance/object.h>
|
||||
|
||||
@ -339,7 +340,7 @@ public:
|
||||
{
|
||||
bool fOK = ProcessVote(nullptr, vote, exception, connman);
|
||||
if (fOK) {
|
||||
vote.Relay(connman);
|
||||
vote.Relay(connman, deterministicMNManager->GetListAtChainTip());
|
||||
}
|
||||
return fOK;
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ bool CGovernanceObject::ProcessVote(CGovernanceManager& govman, const CDetermini
|
||||
bool onlyVotingKeyAllowed = m_obj.type == GovernanceObject::PROPOSAL && vote.GetSignal() == VOTE_SIGNAL_FUNDING;
|
||||
|
||||
// Finally check that the vote is actually valid (done last because of cost of signature verification)
|
||||
if (!vote.IsValid(onlyVotingKeyAllowed)) {
|
||||
if (!vote.IsValid(tip_mn_list, onlyVotingKeyAllowed)) {
|
||||
std::ostringstream ostr;
|
||||
ostr << "CGovernanceObject::ProcessVote -- Invalid vote"
|
||||
<< ", MN outpoint = " << vote.GetMasternodeOutpoint().ToStringShort()
|
||||
@ -191,7 +191,7 @@ bool CGovernanceObject::ProcessVote(CGovernanceManager& govman, const CDetermini
|
||||
fileVotes.AddVote(vote);
|
||||
fDirtyCache = true;
|
||||
// SEND NOTIFICATION TO SCRIPT/ZMQ
|
||||
GetMainSignals().NotifyGovernanceVote(std::make_shared<const CGovernanceVote>(vote));
|
||||
GetMainSignals().NotifyGovernanceVote(tip_mn_list, std::make_shared<const CGovernanceVote>(vote));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ void CGovernanceObject::ClearMasternodeVotes(const CDeterministicMNList& tip_mn_
|
||||
}
|
||||
}
|
||||
|
||||
std::set<uint256> CGovernanceObject::RemoveInvalidVotes(const COutPoint& mnOutpoint)
|
||||
std::set<uint256> CGovernanceObject::RemoveInvalidVotes(const CDeterministicMNList& tip_mn_list, const COutPoint& mnOutpoint)
|
||||
{
|
||||
LOCK(cs);
|
||||
|
||||
@ -221,7 +221,7 @@ std::set<uint256> CGovernanceObject::RemoveInvalidVotes(const COutPoint& mnOutpo
|
||||
return {};
|
||||
}
|
||||
|
||||
auto removedVotes = fileVotes.RemoveInvalidVotes(mnOutpoint, m_obj.type == GovernanceObject::PROPOSAL);
|
||||
auto removedVotes = fileVotes.RemoveInvalidVotes(tip_mn_list, mnOutpoint, m_obj.type == GovernanceObject::PROPOSAL);
|
||||
if (removedVotes.empty()) {
|
||||
return {};
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ public:
|
||||
// This is the case for DIP3 MNs that changed voting or operator keys and
|
||||
// also for MNs that were removed from the list completely.
|
||||
// Returns deleted vote hashes.
|
||||
std::set<uint256> RemoveInvalidVotes(const COutPoint& mnOutpoint);
|
||||
std::set<uint256> RemoveInvalidVotes(const CDeterministicMNList& tip_mn_list, const COutPoint& mnOutpoint);
|
||||
};
|
||||
|
||||
|
||||
|
@ -108,10 +108,9 @@ CGovernanceVote::CGovernanceVote(const COutPoint& outpointMasternodeIn, const ui
|
||||
UpdateHash();
|
||||
}
|
||||
|
||||
std::string CGovernanceVote::ToString() const
|
||||
std::string CGovernanceVote::ToString(const CDeterministicMNList& tip_mn_list) const
|
||||
{
|
||||
auto mnList = deterministicMNManager->GetListAtChainTip();
|
||||
auto dmn = mnList.GetMNByCollateral(masternodeOutpoint);
|
||||
auto dmn = tip_mn_list.GetMNByCollateral(masternodeOutpoint);
|
||||
int voteWeight = dmn != nullptr ? GetMnType(dmn->nType).voting_weight : 0;
|
||||
std::ostringstream ostr;
|
||||
ostr << masternodeOutpoint.ToStringShort() << ":"
|
||||
@ -122,7 +121,7 @@ std::string CGovernanceVote::ToString() const
|
||||
return ostr.str();
|
||||
}
|
||||
|
||||
void CGovernanceVote::Relay(CConnman& connman) const
|
||||
void CGovernanceVote::Relay(CConnman& connman, const CDeterministicMNList& tip_mn_list) const
|
||||
{
|
||||
// Do not relay until fully synced
|
||||
if (!::masternodeSync->IsSynced()) {
|
||||
@ -130,8 +129,7 @@ void CGovernanceVote::Relay(CConnman& connman) const
|
||||
return;
|
||||
}
|
||||
|
||||
auto mnList = deterministicMNManager->GetListAtChainTip();
|
||||
auto dmn = mnList.GetMNByCollateral(masternodeOutpoint);
|
||||
auto dmn = tip_mn_list.GetMNByCollateral(masternodeOutpoint);
|
||||
if (!dmn) {
|
||||
return;
|
||||
}
|
||||
@ -244,7 +242,7 @@ bool CGovernanceVote::CheckSignature(const CBLSPublicKey& pubKey) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGovernanceVote::IsValid(bool useVotingKey) const
|
||||
bool CGovernanceVote::IsValid(const CDeterministicMNList& tip_mn_list, bool useVotingKey) const
|
||||
{
|
||||
if (nTime > GetAdjustedTime() + (60 * 60)) {
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceVote::IsValid -- vote is too far ahead of current time - %s - nTime %lli - Max Time %lli\n", GetHash().ToString(), nTime, GetAdjustedTime() + (60 * 60));
|
||||
@ -263,7 +261,7 @@ bool CGovernanceVote::IsValid(bool useVotingKey) const
|
||||
return false;
|
||||
}
|
||||
|
||||
auto dmn = deterministicMNManager->GetListAtChainTip().GetMNByCollateral(masternodeOutpoint);
|
||||
auto dmn = tip_mn_list.GetMNByCollateral(masternodeOutpoint);
|
||||
if (!dmn) {
|
||||
LogPrint(BCLog::GOBJECT, "CGovernanceVote::IsValid -- Unknown Masternode - %s\n", masternodeOutpoint.ToStringShort());
|
||||
return false;
|
||||
|
@ -12,6 +12,7 @@ class CGovernanceVote;
|
||||
class CBLSPublicKey;
|
||||
class CBLSSecretKey;
|
||||
class CConnman;
|
||||
class CDeterministicMNList;
|
||||
class CKey;
|
||||
class CKeyID;
|
||||
|
||||
@ -102,8 +103,8 @@ public:
|
||||
bool CheckSignature(const CKeyID& keyID) const;
|
||||
bool Sign(const CBLSSecretKey& key);
|
||||
bool CheckSignature(const CBLSPublicKey& pubKey) const;
|
||||
bool IsValid(bool useVotingKey) const;
|
||||
void Relay(CConnman& connman) const;
|
||||
bool IsValid(const CDeterministicMNList& tip_mn_list, bool useVotingKey) const;
|
||||
void Relay(CConnman& connman, const CDeterministicMNList& tip_mn_list) const;
|
||||
|
||||
const COutPoint& GetMasternodeOutpoint() const { return masternodeOutpoint; }
|
||||
|
||||
@ -116,7 +117,7 @@ public:
|
||||
uint256 GetHash() const;
|
||||
uint256 GetSignatureHash() const;
|
||||
|
||||
std::string ToString() const;
|
||||
std::string ToString(const CDeterministicMNList& tip_mn_list) const;
|
||||
|
||||
SERIALIZE_METHODS(CGovernanceVote, obj)
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ void CGovernanceObjectVoteFile::RemoveVotesFromMasternode(const COutPoint& outpo
|
||||
}
|
||||
}
|
||||
|
||||
std::set<uint256> CGovernanceObjectVoteFile::RemoveInvalidVotes(const COutPoint& outpointMasternode, bool fProposal)
|
||||
std::set<uint256> CGovernanceObjectVoteFile::RemoveInvalidVotes(const CDeterministicMNList& tip_mn_list, const COutPoint& outpointMasternode, bool fProposal)
|
||||
{
|
||||
std::set<uint256> removedVotes;
|
||||
|
||||
@ -76,7 +76,7 @@ std::set<uint256> CGovernanceObjectVoteFile::RemoveInvalidVotes(const COutPoint&
|
||||
while (it != listVotes.end()) {
|
||||
if (it->GetMasternodeOutpoint() == outpointMasternode) {
|
||||
bool useVotingKey = fProposal && (it->GetSignal() == VOTE_SIGNAL_FUNDING);
|
||||
if (!it->IsValid(useVotingKey)) {
|
||||
if (!it->IsValid(tip_mn_list, useVotingKey)) {
|
||||
removedVotes.emplace(it->GetHash());
|
||||
--nMemoryVotes;
|
||||
mapVoteIndex.erase(it->GetHash());
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
class CDeterministicMNList;
|
||||
|
||||
/**
|
||||
* Represents the collection of votes associated with a given CGovernanceObject
|
||||
* Recently received votes are held in memory until a maximum size is reached after
|
||||
@ -64,7 +66,7 @@ public:
|
||||
std::vector<CGovernanceVote> GetVotes() const;
|
||||
|
||||
void RemoveVotesFromMasternode(const COutPoint& outpointMasternode);
|
||||
std::set<uint256> RemoveInvalidVotes(const COutPoint& outpointMasternode, bool fProposal);
|
||||
std::set<uint256> RemoveInvalidVotes(const CDeterministicMNList& tip_mn_list, const COutPoint& outpointMasternode, bool fProposal);
|
||||
|
||||
SERIALIZE_METHODS(CGovernanceObjectVoteFile, obj)
|
||||
{
|
||||
|
@ -861,10 +861,10 @@ static UniValue gobject_getcurrentvotes(const JSONRPCRequest& request)
|
||||
UniValue bResult(UniValue::VOBJ);
|
||||
|
||||
// GET MATCHING VOTES BY HASH, THEN SHOW USERS VOTE INFORMATION
|
||||
|
||||
CHECK_NONFATAL(node.dmnman);
|
||||
std::vector<CGovernanceVote> vecVotes = node.govman->GetCurrentVotes(hash, mnCollateralOutpoint);
|
||||
for (const auto& vote : vecVotes) {
|
||||
bResult.pushKV(vote.GetHash().ToString(), vote.ToString());
|
||||
bResult.pushKV(vote.GetHash().ToString(), vote.ToString(node.dmnman->GetListAtChainTip()));
|
||||
}
|
||||
|
||||
return bResult;
|
||||
@ -1005,7 +1005,9 @@ static UniValue voteraw(const JSONRPCRequest& request)
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Malformed base64 encoding");
|
||||
}
|
||||
|
||||
auto dmn = node.dmnman->GetListAtChainTip().GetValidMNByCollateral(outpoint);
|
||||
CHECK_NONFATAL(node.dmnman);
|
||||
const auto tip_mn_list = node.dmnman->GetListAtChainTip();
|
||||
auto dmn = tip_mn_list.GetValidMNByCollateral(outpoint);
|
||||
|
||||
if (!dmn) {
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Failure to find masternode in list : " + outpoint.ToStringShort());
|
||||
@ -1017,7 +1019,7 @@ static UniValue voteraw(const JSONRPCRequest& request)
|
||||
|
||||
bool onlyVotingKeyAllowed = govObjType == GovernanceObject::PROPOSAL && vote.GetSignal() == VOTE_SIGNAL_FUNDING;
|
||||
|
||||
if (!vote.IsValid(onlyVotingKeyAllowed)) {
|
||||
if (!vote.IsValid(tip_mn_list, onlyVotingKeyAllowed)) {
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Failure to verify vote.");
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <primitives/block.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <scheduler.h>
|
||||
|
||||
#include <evo/deterministicmns.h>
|
||||
#include <governance/vote.h>
|
||||
#include <llmq/clsig.h>
|
||||
#include <llmq/signing.h>
|
||||
@ -288,9 +288,9 @@ void CMainSignals::NotifyChainLock(const CBlockIndex* pindex, const std::shared_
|
||||
clsig->ToString());
|
||||
}
|
||||
|
||||
void CMainSignals::NotifyGovernanceVote(const std::shared_ptr<const CGovernanceVote>& vote) {
|
||||
auto event = [vote, this] {
|
||||
m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.NotifyGovernanceVote(vote); });
|
||||
void CMainSignals::NotifyGovernanceVote(const CDeterministicMNList& tip_mn_list, const std::shared_ptr<const CGovernanceVote>& vote) {
|
||||
auto event = [vote, tip_mn_list, this] {
|
||||
m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.NotifyGovernanceVote(tip_mn_list, vote); });
|
||||
};
|
||||
ENQUEUE_AND_LOG_EVENT(event, "%s: notify governance vote: %s", __func__, vote->GetHash().ToString());
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ protected:
|
||||
virtual void BlockDisconnected(const std::shared_ptr<const CBlock> &block, const CBlockIndex *pindex) {}
|
||||
virtual void NotifyTransactionLock(const CTransactionRef &tx, const std::shared_ptr<const llmq::CInstantSendLock>& islock) {}
|
||||
virtual void NotifyChainLock(const CBlockIndex* pindex, const std::shared_ptr<const llmq::CChainLockSig>& clsig) {}
|
||||
virtual void NotifyGovernanceVote(const std::shared_ptr<const CGovernanceVote>& vote) {}
|
||||
virtual void NotifyGovernanceVote(const CDeterministicMNList& tip_mn_list, const std::shared_ptr<const CGovernanceVote>& vote) {}
|
||||
virtual void NotifyGovernanceObject(const std::shared_ptr<const Governance::Object>& object) {}
|
||||
virtual void NotifyInstantSendDoubleSpendAttempt(const CTransactionRef& currentTx, const CTransactionRef& previousTx) {}
|
||||
virtual void NotifyRecoveredSig(const std::shared_ptr<const llmq::CRecoveredSig>& sig) {}
|
||||
@ -232,7 +232,7 @@ public:
|
||||
void BlockDisconnected(const std::shared_ptr<const CBlock> &, const CBlockIndex* pindex);
|
||||
void NotifyTransactionLock(const CTransactionRef &tx, const std::shared_ptr<const llmq::CInstantSendLock>& islock);
|
||||
void NotifyChainLock(const CBlockIndex* pindex, const std::shared_ptr<const llmq::CChainLockSig>& clsig);
|
||||
void NotifyGovernanceVote(const std::shared_ptr<const CGovernanceVote>& vote);
|
||||
void NotifyGovernanceVote(const CDeterministicMNList& tip_mn_list, const std::shared_ptr<const CGovernanceVote>& vote);
|
||||
void NotifyGovernanceObject(const std::shared_ptr<const Governance::Object>& object);
|
||||
void NotifyInstantSendDoubleSpendAttempt(const CTransactionRef ¤tTx, const CTransactionRef &previousTx);
|
||||
void NotifyRecoveredSig(const std::shared_ptr<const llmq::CRecoveredSig> &sig);
|
||||
|
@ -33,7 +33,7 @@ bool CZMQAbstractNotifier::NotifyTransactionLock(const CTransactionRef &/*transa
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CZMQAbstractNotifier::NotifyGovernanceVote(const std::shared_ptr<const CGovernanceVote> & /*vote*/)
|
||||
bool CZMQAbstractNotifier::NotifyGovernanceVote(const CDeterministicMNList& /*tip_mn_list*/, const std::shared_ptr<const CGovernanceVote> & /*vote*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <string>
|
||||
|
||||
class CBlockIndex;
|
||||
class CDeterministicMNList;
|
||||
class CGovernanceVote;
|
||||
class CTransaction;
|
||||
class CZMQAbstractNotifier;
|
||||
@ -61,7 +62,7 @@ public:
|
||||
virtual bool NotifyChainLock(const CBlockIndex *pindex, const std::shared_ptr<const llmq::CChainLockSig>& clsig);
|
||||
virtual bool NotifyTransaction(const CTransaction &transaction);
|
||||
virtual bool NotifyTransactionLock(const CTransactionRef& transaction, const std::shared_ptr<const llmq::CInstantSendLock>& islock);
|
||||
virtual bool NotifyGovernanceVote(const std::shared_ptr<const CGovernanceVote>& vote);
|
||||
virtual bool NotifyGovernanceVote(const CDeterministicMNList& tip_mn_list, const std::shared_ptr<const CGovernanceVote>& vote);
|
||||
virtual bool NotifyGovernanceObject(const std::shared_ptr<const Governance::Object>& object);
|
||||
virtual bool NotifyInstantSendDoubleSpendAttempt(const CTransactionRef& currentTx, const CTransactionRef& previousTx);
|
||||
virtual bool NotifyRecoveredSig(const std::shared_ptr<const llmq::CRecoveredSig>& sig);
|
||||
|
@ -191,10 +191,10 @@ void CZMQNotificationInterface::NotifyTransactionLock(const CTransactionRef& tx,
|
||||
});
|
||||
}
|
||||
|
||||
void CZMQNotificationInterface::NotifyGovernanceVote(const std::shared_ptr<const CGovernanceVote> &vote)
|
||||
void CZMQNotificationInterface::NotifyGovernanceVote(const CDeterministicMNList& tip_mn_list, const std::shared_ptr<const CGovernanceVote> &vote)
|
||||
{
|
||||
TryForEachAndRemoveFailed(notifiers, [&vote](CZMQAbstractNotifier* notifier) {
|
||||
return notifier->NotifyGovernanceVote(vote);
|
||||
TryForEachAndRemoveFailed(notifiers, [&tip_mn_list, &vote](CZMQAbstractNotifier* notifier) {
|
||||
return notifier->NotifyGovernanceVote(tip_mn_list, vote);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ protected:
|
||||
void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) override;
|
||||
void NotifyChainLock(const CBlockIndex *pindex, const std::shared_ptr<const llmq::CChainLockSig>& clsig) override;
|
||||
void NotifyTransactionLock(const CTransactionRef &tx, const std::shared_ptr<const llmq::CInstantSendLock>& islock) override;
|
||||
void NotifyGovernanceVote(const std::shared_ptr<const CGovernanceVote>& vote) override;
|
||||
void NotifyGovernanceVote(const CDeterministicMNList& tip_mn_list, const std::shared_ptr<const CGovernanceVote>& vote) override;
|
||||
void NotifyGovernanceObject(const std::shared_ptr<const Governance::Object>& object) override;
|
||||
void NotifyInstantSendDoubleSpendAttempt(const CTransactionRef& currentTx, const CTransactionRef& previousTx) override;
|
||||
void NotifyRecoveredSig(const std::shared_ptr<const llmq::CRecoveredSig>& sig) override;
|
||||
|
@ -235,7 +235,7 @@ bool CZMQPublishHashTransactionLockNotifier::NotifyTransactionLock(const CTransa
|
||||
return SendZmqMessage(MSG_HASHTXLOCK, data, 32);
|
||||
}
|
||||
|
||||
bool CZMQPublishHashGovernanceVoteNotifier::NotifyGovernanceVote(const std::shared_ptr<const CGovernanceVote>& vote)
|
||||
bool CZMQPublishHashGovernanceVoteNotifier::NotifyGovernanceVote(const CDeterministicMNList& tip_mn_list, const std::shared_ptr<const CGovernanceVote>& vote)
|
||||
{
|
||||
uint256 hash = vote->GetHash();
|
||||
LogPrint(BCLog::ZMQ, "zmq: Publish hashgovernancevote %s\n", hash.GetHex());
|
||||
@ -369,10 +369,10 @@ bool CZMQPublishRawTransactionLockSigNotifier::NotifyTransactionLock(const CTran
|
||||
return SendZmqMessage(MSG_RAWTXLOCKSIG, &(*ss.begin()), ss.size());
|
||||
}
|
||||
|
||||
bool CZMQPublishRawGovernanceVoteNotifier::NotifyGovernanceVote(const std::shared_ptr<const CGovernanceVote>& vote)
|
||||
bool CZMQPublishRawGovernanceVoteNotifier::NotifyGovernanceVote(const CDeterministicMNList& tip_mn_list, const std::shared_ptr<const CGovernanceVote>& vote)
|
||||
{
|
||||
uint256 nHash = vote->GetHash();
|
||||
LogPrint(BCLog::ZMQ, "zmq: Publish rawgovernanceobject: hash = %s to %s, vote = %d\n", nHash.ToString(), this->address, vote->ToString());
|
||||
LogPrint(BCLog::ZMQ, "zmq: Publish rawgovernanceobject: hash = %s to %s, vote = %d\n", nHash.ToString(), this->address, vote->ToString(tip_mn_list));
|
||||
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ss << *vote;
|
||||
return SendZmqMessage(MSG_RAWGVOTE, &(*ss.begin()), ss.size());
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <zmq/zmqabstractnotifier.h>
|
||||
|
||||
class CBlockIndex;
|
||||
class CDeterministicMNList;
|
||||
class CGovernanceVote;
|
||||
|
||||
namespace Governance
|
||||
@ -62,7 +63,7 @@ public:
|
||||
class CZMQPublishHashGovernanceVoteNotifier : public CZMQAbstractPublishNotifier
|
||||
{
|
||||
public:
|
||||
bool NotifyGovernanceVote(const std::shared_ptr<const CGovernanceVote>& vote) override;
|
||||
bool NotifyGovernanceVote(const CDeterministicMNList& tip_mn_list, const std::shared_ptr<const CGovernanceVote>& vote) override;
|
||||
};
|
||||
|
||||
class CZMQPublishHashGovernanceObjectNotifier : public CZMQAbstractPublishNotifier
|
||||
@ -122,7 +123,7 @@ public:
|
||||
class CZMQPublishRawGovernanceVoteNotifier : public CZMQAbstractPublishNotifier
|
||||
{
|
||||
public:
|
||||
bool NotifyGovernanceVote(const std::shared_ptr<const CGovernanceVote>& vote) override;
|
||||
bool NotifyGovernanceVote(const CDeterministicMNList& tip_mn_list, const std::shared_ptr<const CGovernanceVote>& vote) override;
|
||||
};
|
||||
|
||||
class CZMQPublishRawGovernanceObjectNotifier : public CZMQAbstractPublishNotifier
|
||||
|
@ -98,6 +98,7 @@ EXPECTED_CIRCULAR_DEPENDENCIES=(
|
||||
"evo/mnhftx -> validation -> evo/mnhftx"
|
||||
"evo/deterministicmns -> validation -> evo/deterministicmns"
|
||||
"evo/chainhelper -> masternode/payments -> validation -> evo/chainhelper"
|
||||
"evo/deterministicmns -> validationinterface -> evo/deterministicmns"
|
||||
)
|
||||
|
||||
EXIT_CODE=0
|
||||
|
Loading…
Reference in New Issue
Block a user