diff --git a/src/evo/mnauth.cpp b/src/evo/mnauth.cpp index 9e9de36f9718c..854574a0337cd 100644 --- a/src/evo/mnauth.cpp +++ b/src/evo/mnauth.cpp @@ -61,7 +61,8 @@ void CMNAuth::PushMNAUTH(CNode& peer, CConnman& connman, const CActiveMasternode } PeerMsgRet CMNAuth::ProcessMessage(CNode& peer, CConnman& connman, CMasternodeMetaMan& mn_metaman, const CActiveMasternodeManager* const mn_activeman, - const CMasternodeSync& mn_sync, const CDeterministicMNList& tip_mn_list, std::string_view msg_type, CDataStream& vRecv) + const CChain& active_chain, const CMasternodeSync& mn_sync, const CDeterministicMNList& tip_mn_list, + std::string_view msg_type, CDataStream& vRecv) { assert(mn_metaman.IsValid()); @@ -105,7 +106,7 @@ PeerMsgRet CMNAuth::ProcessMessage(CNode& peer, CConnman& connman, CMasternodeMe if (Params().NetworkIDString() != CBaseChainParams::MAIN && gArgs.IsArgSet("-pushversion")) { nOurNodeVersion = gArgs.GetArg("-pushversion", PROTOCOL_VERSION); } - const CBlockIndex* tip = ::ChainActive().Tip(); + const CBlockIndex* tip = active_chain.Tip(); const bool is_basic_scheme_active{DeploymentActiveAfter(tip, Params().GetConsensus(), Consensus::DEPLOYMENT_V19)}; ConstCBLSPublicKeyVersionWrapper pubKey(dmn->pdmnState->pubKeyOperator.Get(), !is_basic_scheme_active); // See comment in PushMNAUTH (fInbound is negated here as we're on the other side of the connection) diff --git a/src/evo/mnauth.h b/src/evo/mnauth.h index 211dae0cf20cc..802b8e64f1d8a 100644 --- a/src/evo/mnauth.h +++ b/src/evo/mnauth.h @@ -11,6 +11,7 @@ class CActiveMasternodeManager; class CBlockIndex; +class CChain; class CConnman; class CDataStream; class CDeterministicMN; @@ -59,7 +60,8 @@ class CMNAuth * attempting to call this function regardless of sync state */ static PeerMsgRet ProcessMessage(CNode& peer, CConnman& connman, CMasternodeMetaMan& mn_metaman, const CActiveMasternodeManager* const mn_activeman, - const CMasternodeSync& mn_sync, const CDeterministicMNList& tip_mn_list, std::string_view msg_type, CDataStream& vRecv); + const CChain& active_chain, const CMasternodeSync& mn_sync, const CDeterministicMNList& tip_mn_list, + std::string_view msg_type, CDataStream& vRecv); static void NotifyMasternodeListChanged(bool undo, const CDeterministicMNList& oldMNList, const CDeterministicMNListDiff& diff, CConnman& connman); }; diff --git a/src/evo/mnhftx.cpp b/src/evo/mnhftx.cpp index 8f1a14d92bb53..02f1839f087fb 100644 --- a/src/evo/mnhftx.cpp +++ b/src/evo/mnhftx.cpp @@ -101,7 +101,7 @@ bool MNHFTx::Verify(const llmq::CQuorumManager& qman, const uint256& quorumHash, return true; } -bool CheckMNHFTx(const llmq::CQuorumManager& qman, const CTransaction& tx, const CBlockIndex* pindexPrev, TxValidationState& state) +bool CheckMNHFTx(const ChainstateManager& chainman, const llmq::CQuorumManager& qman, const CTransaction& tx, const CBlockIndex* pindexPrev, TxValidationState& state) { if (!tx.IsSpecialTxVersion() || tx.nType != TRANSACTION_MNHF_SIGNAL) { return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-mnhf-type"); @@ -116,7 +116,7 @@ bool CheckMNHFTx(const llmq::CQuorumManager& qman, const CTransaction& tx, const return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-mnhf-version"); } - const CBlockIndex* pindexQuorum = WITH_LOCK(::cs_main, return g_chainman.m_blockman.LookupBlockIndex(mnhfTx.signal.quorumHash)); + const CBlockIndex* pindexQuorum = WITH_LOCK(::cs_main, return chainman.m_blockman.LookupBlockIndex(mnhfTx.signal.quorumHash)); if (!pindexQuorum) { return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-mnhf-quorum-hash"); } @@ -160,7 +160,7 @@ std::optional extractEHFSignal(const CTransaction& tx) return opt_mnhfTx->signal.versionBit; } -static bool extractSignals(const llmq::CQuorumManager& qman, const CBlock& block, const CBlockIndex* const pindex, std::vector& new_signals, BlockValidationState& state) +static bool extractSignals(const ChainstateManager& chainman, const llmq::CQuorumManager& qman, const CBlock& block, const CBlockIndex* const pindex, std::vector& new_signals, BlockValidationState& state) { // we skip the coinbase for (size_t i = 1; i < block.vtx.size(); ++i) { @@ -172,7 +172,7 @@ static bool extractSignals(const llmq::CQuorumManager& qman, const CBlock& block } TxValidationState tx_state; - if (!CheckMNHFTx(qman, tx, pindex, tx_state)) { + if (!CheckMNHFTx(chainman, qman, tx, pindex, tx_state)) { return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, tx_state.GetRejectReason(), tx_state.GetDebugMessage()); } @@ -192,11 +192,11 @@ static bool extractSignals(const llmq::CQuorumManager& qman, const CBlock& block std::optional CMNHFManager::ProcessBlock(const CBlock& block, const CBlockIndex* const pindex, bool fJustCheck, BlockValidationState& state) { - assert(m_qman); + assert(m_chainman && m_qman); try { std::vector new_signals; - if (!extractSignals(*m_qman, block, pindex, new_signals, state)) { + if (!extractSignals(*m_chainman, *m_qman, block, pindex, new_signals, state)) { // state is set inside extractSignals return std::nullopt; } @@ -246,11 +246,11 @@ std::optional CMNHFManager::ProcessBlock(const CBlock& bl bool CMNHFManager::UndoBlock(const CBlock& block, const CBlockIndex* const pindex) { - assert(m_qman); + assert(m_chainman && m_qman); std::vector excluded_signals; BlockValidationState state; - if (!extractSignals(*m_qman, block, pindex, excluded_signals, state)) { + if (!extractSignals(*m_chainman, *m_qman, block, pindex, excluded_signals, state)) { LogPrintf("CMNHFManager::%s: failed to extract signals\n", __func__); return false; } @@ -354,10 +354,11 @@ void CMNHFManager::AddSignal(const CBlockIndex* const pindex, int bit) AddToCache(signals, pindex); } -void CMNHFManager::ConnectManagers(gsl::not_null qman) +void CMNHFManager::ConnectManagers(gsl::not_null chainman, gsl::not_null qman) { // Do not allow double-initialization - assert(m_qman == nullptr); + assert(m_chainman == nullptr && m_qman == nullptr); + m_chainman = chainman; m_qman = qman; } diff --git a/src/evo/mnhftx.h b/src/evo/mnhftx.h index 53425d60ab288..a6386203dc1e0 100644 --- a/src/evo/mnhftx.h +++ b/src/evo/mnhftx.h @@ -22,6 +22,7 @@ class BlockValidationState; class CBlock; class CBlockIndex; class CEvoDB; +class ChainstateManager; class TxValidationState; namespace llmq { class CQuorumManager; @@ -100,6 +101,7 @@ class CMNHFManager : public AbstractEHFManager { private: CEvoDB& m_evoDb; + ChainstateManager* m_chainman{nullptr}; llmq::CQuorumManager* m_qman{nullptr}; static constexpr size_t MNHFCacheSize = 1000; @@ -147,14 +149,14 @@ class CMNHFManager : public AbstractEHFManager * Separated from constructor to allow LLMQContext to use CMNHFManager in read-only capacity. * Required to mutate state. */ - void ConnectManagers(gsl::not_null qman); + void ConnectManagers(gsl::not_null chainman, gsl::not_null qman); /** * Reset llmq::CQuorumManager pointer. * * @pre Must be called before LLMQContext (containing llmq::CQuorumManager) is destroyed. */ - void DisconnectManagers() { m_qman = nullptr; }; + void DisconnectManagers() { m_chainman = nullptr; m_qman = nullptr; }; private: void AddToCache(const Signals& signals, const CBlockIndex* const pindex); @@ -175,6 +177,6 @@ class CMNHFManager : public AbstractEHFManager }; std::optional extractEHFSignal(const CTransaction& tx); -bool CheckMNHFTx(const llmq::CQuorumManager& qman, const CTransaction& tx, const CBlockIndex* pindexPrev, TxValidationState& state); +bool CheckMNHFTx(const ChainstateManager& chainman, const llmq::CQuorumManager& qman, const CTransaction& tx, const CBlockIndex* pindexPrev, TxValidationState& state); #endif // BITCOIN_EVO_MNHFTX_H diff --git a/src/evo/simplifiedmns.cpp b/src/evo/simplifiedmns.cpp index bc80c1dd68341..41c3138c66526 100644 --- a/src/evo/simplifiedmns.cpp +++ b/src/evo/simplifiedmns.cpp @@ -316,29 +316,29 @@ CSimplifiedMNListDiff BuildSimplifiedDiff(const CDeterministicMNList& from, cons return diffRet; } -bool BuildSimplifiedMNListDiff(const uint256& baseBlockHash, const uint256& blockHash, CSimplifiedMNListDiff& mnListDiffRet, - CDeterministicMNManager& dmnman, const llmq::CQuorumBlockProcessor& quorum_block_processor, const llmq::CQuorumManager& qman, - std::string& errorRet, bool extended) +bool BuildSimplifiedMNListDiff(CDeterministicMNManager& dmnman, const ChainstateManager& chainman, const llmq::CQuorumBlockProcessor& qblockman, + const llmq::CQuorumManager& qman, const uint256& baseBlockHash, const uint256& blockHash, + CSimplifiedMNListDiff& mnListDiffRet, std::string& errorRet, bool extended) { AssertLockHeld(cs_main); mnListDiffRet = CSimplifiedMNListDiff(); - const CBlockIndex* baseBlockIndex = ::ChainActive().Genesis(); + const CBlockIndex* baseBlockIndex = chainman.ActiveChain().Genesis(); if (!baseBlockHash.IsNull()) { - baseBlockIndex = g_chainman.m_blockman.LookupBlockIndex(baseBlockHash); + baseBlockIndex = chainman.m_blockman.LookupBlockIndex(baseBlockHash); if (!baseBlockIndex) { errorRet = strprintf("block %s not found", baseBlockHash.ToString()); return false; } } - const CBlockIndex* blockIndex = g_chainman.m_blockman.LookupBlockIndex(blockHash); + const CBlockIndex* blockIndex = chainman.m_blockman.LookupBlockIndex(blockHash); if (!blockIndex) { errorRet = strprintf("block %s not found", blockHash.ToString()); return false; } - if (!::ChainActive().Contains(baseBlockIndex) || !::ChainActive().Contains(blockIndex)) { + if (!chainman.ActiveChain().Contains(baseBlockIndex) || !chainman.ActiveChain().Contains(blockIndex)) { errorRet = strprintf("block %s and %s are not in the same chain", baseBlockHash.ToString(), blockHash.ToString()); return false; } @@ -356,7 +356,7 @@ bool BuildSimplifiedMNListDiff(const uint256& baseBlockHash, const uint256& bloc // null block hash was provided to get the diff from the genesis block. mnListDiffRet.baseBlockHash = baseBlockHash; - if (!mnListDiffRet.BuildQuorumsDiff(baseBlockIndex, blockIndex, quorum_block_processor)) { + if (!mnListDiffRet.BuildQuorumsDiff(baseBlockIndex, blockIndex, qblockman)) { errorRet = strprintf("failed to build quorums diff"); return false; } diff --git a/src/evo/simplifiedmns.h b/src/evo/simplifiedmns.h index 47e4c105f9547..ed894f9ff227d 100644 --- a/src/evo/simplifiedmns.h +++ b/src/evo/simplifiedmns.h @@ -16,6 +16,7 @@ class UniValue; class CBlockIndex; class CDeterministicMNList; class CDeterministicMN; +class ChainstateManager; namespace llmq { class CFinalCommitment; @@ -170,8 +171,8 @@ class CSimplifiedMNListDiff [[nodiscard]] UniValue ToJson(bool extended = false) const; }; -bool BuildSimplifiedMNListDiff(const uint256& baseBlockHash, const uint256& blockHash, CSimplifiedMNListDiff& mnListDiffRet, - CDeterministicMNManager& dmnman, const llmq::CQuorumBlockProcessor& quorum_block_processor, const llmq::CQuorumManager& qman, - std::string& errorRet, bool extended = false); +bool BuildSimplifiedMNListDiff(CDeterministicMNManager& dmnman, const ChainstateManager& chainman, const llmq::CQuorumBlockProcessor& qblockman, + const llmq::CQuorumManager& qman, const uint256& baseBlockHash, const uint256& blockHash, + CSimplifiedMNListDiff& mnListDiffRet, std::string& errorRet, bool extended = false); #endif // BITCOIN_EVO_SIMPLIFIEDMNS_H diff --git a/src/evo/specialtxman.cpp b/src/evo/specialtxman.cpp index cc702286a735c..3bee881d5e647 100644 --- a/src/evo/specialtxman.cpp +++ b/src/evo/specialtxman.cpp @@ -51,7 +51,7 @@ static bool CheckSpecialTxInner(CDeterministicMNManager& dmnman, const Chainstat if (!DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_V20)) { return state.Invalid(TxValidationResult::TX_CONSENSUS, "mnhf-before-v20"); } - return CheckMNHFTx(qman, tx, pindexPrev, state); + return CheckMNHFTx(chainman, qman, tx, pindexPrev, state); case TRANSACTION_ASSET_LOCK: if (!DeploymentActiveAfter(pindexPrev, consensusParams, Consensus::DEPLOYMENT_V20)) { return state.Invalid(TxValidationResult::TX_CONSENSUS, "assetlocks-before-v20"); diff --git a/src/init.cpp b/src/init.cpp index ab51a2054da65..5b4044b485b06 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -2016,7 +2016,7 @@ bool AppInitMain(const CoreContext& context, NodeContext& node, interfaces::Bloc node.llmq_ctx = std::make_unique(chainman.ActiveChainstate(), *node.connman, *node.dmnman, *node.evodb, *node.mn_metaman, *node.mnhf_manager, *node.sporkman, *node.mempool, node.mn_activeman.get(), *node.mn_sync, node.peerman, /* unit_tests = */ false, /* wipe = */ fReset || fReindexChainState); // Enable CMNHFManager::{Process, Undo}Block - node.mnhf_manager->ConnectManagers(node.llmq_ctx->qman.get()); + node.mnhf_manager->ConnectManagers(node.chainman, node.llmq_ctx->qman.get()); // Have to start it early to let VerifyDB check ChainLock signatures in coinbase node.llmq_ctx->Start(); diff --git a/src/llmq/snapshot.cpp b/src/llmq/snapshot.cpp index 77cf70eb7c938..1224eae2d7ce4 100644 --- a/src/llmq/snapshot.cpp +++ b/src/llmq/snapshot.cpp @@ -85,9 +85,9 @@ UniValue CQuorumRotationInfo::ToJson() const return obj; } -bool BuildQuorumRotationInfo(const CGetQuorumRotationInfo& request, CQuorumRotationInfo& response, - CDeterministicMNManager& dmnman, const ChainstateManager& chainman, const CQuorumManager& qman, - const CQuorumBlockProcessor& quorum_block_processor, std::string& errorRet) +bool BuildQuorumRotationInfo(CDeterministicMNManager& dmnman, const ChainstateManager& chainman, const CQuorumManager& qman, + const CQuorumBlockProcessor& qblockman, const CGetQuorumRotationInfo& request, + CQuorumRotationInfo& response, std::string& errorRet) { AssertLockHeld(cs_main); @@ -123,7 +123,7 @@ bool BuildQuorumRotationInfo(const CGetQuorumRotationInfo& request, CQuorumRotat return false; } //Build MN list Diff always with highest baseblock - if (!BuildSimplifiedMNListDiff(baseBlockIndexes.back()->GetBlockHash(), tipBlockIndex->GetBlockHash(), response.mnListDiffTip, dmnman, quorum_block_processor, qman, errorRet)) { + if (!BuildSimplifiedMNListDiff(dmnman, chainman, qblockman, qman, baseBlockIndexes.back()->GetBlockHash(), tipBlockIndex->GetBlockHash(), response.mnListDiffTip, errorRet)) { return false; } @@ -156,7 +156,7 @@ bool BuildQuorumRotationInfo(const CGetQuorumRotationInfo& request, CQuorumRotat } //Build MN list Diff always with highest baseblock - if (!BuildSimplifiedMNListDiff(GetLastBaseBlockHash(baseBlockIndexes, pWorkBlockIndex), pWorkBlockIndex->GetBlockHash(), response.mnListDiffH, dmnman, quorum_block_processor, qman, errorRet)) { + if (!BuildSimplifiedMNListDiff(dmnman, chainman, qblockman, qman, GetLastBaseBlockHash(baseBlockIndexes, pWorkBlockIndex), pWorkBlockIndex->GetBlockHash(), response.mnListDiffH, errorRet)) { return false; } @@ -202,7 +202,7 @@ bool BuildQuorumRotationInfo(const CGetQuorumRotationInfo& request, CQuorumRotat const CBlockIndex* pWorkBlockHMinus4CIndex = pBlockHMinus4CIndex->GetAncestor(pBlockHMinus4CIndex->nHeight - workDiff); //Checked later if extraShare is on - if (!BuildSimplifiedMNListDiff(GetLastBaseBlockHash(baseBlockIndexes, pWorkBlockHMinusCIndex), pWorkBlockHMinusCIndex->GetBlockHash(), response.mnListDiffAtHMinusC, dmnman, quorum_block_processor, qman, errorRet)) { + if (!BuildSimplifiedMNListDiff(dmnman, chainman, qblockman, qman, GetLastBaseBlockHash(baseBlockIndexes, pWorkBlockHMinusCIndex), pWorkBlockHMinusCIndex->GetBlockHash(), response.mnListDiffAtHMinusC, errorRet)) { return false; } @@ -214,7 +214,7 @@ bool BuildQuorumRotationInfo(const CGetQuorumRotationInfo& request, CQuorumRotat response.quorumSnapshotAtHMinusC = std::move(snapshotHMinusC.value()); } - if (!BuildSimplifiedMNListDiff(GetLastBaseBlockHash(baseBlockIndexes, pWorkBlockHMinus2CIndex), pWorkBlockHMinus2CIndex->GetBlockHash(), response.mnListDiffAtHMinus2C, dmnman, quorum_block_processor, qman, errorRet)) { + if (!BuildSimplifiedMNListDiff(dmnman, chainman, qblockman, qman, GetLastBaseBlockHash(baseBlockIndexes, pWorkBlockHMinus2CIndex), pWorkBlockHMinus2CIndex->GetBlockHash(), response.mnListDiffAtHMinus2C, errorRet)) { return false; } @@ -226,7 +226,7 @@ bool BuildQuorumRotationInfo(const CGetQuorumRotationInfo& request, CQuorumRotat response.quorumSnapshotAtHMinus2C = std::move(snapshotHMinus2C.value()); } - if (!BuildSimplifiedMNListDiff(GetLastBaseBlockHash(baseBlockIndexes, pWorkBlockHMinus3CIndex), pWorkBlockHMinus3CIndex->GetBlockHash(), response.mnListDiffAtHMinus3C, dmnman, quorum_block_processor, qman, errorRet)) { + if (!BuildSimplifiedMNListDiff(dmnman, chainman, qblockman, qman, GetLastBaseBlockHash(baseBlockIndexes, pWorkBlockHMinus3CIndex), pWorkBlockHMinus3CIndex->GetBlockHash(), response.mnListDiffAtHMinus3C, errorRet)) { return false; } @@ -255,7 +255,7 @@ bool BuildQuorumRotationInfo(const CGetQuorumRotationInfo& request, CQuorumRotat } CSimplifiedMNListDiff mn4c; - if (!BuildSimplifiedMNListDiff(GetLastBaseBlockHash(baseBlockIndexes, pWorkBlockHMinus4CIndex), pWorkBlockHMinus4CIndex->GetBlockHash(), mn4c, dmnman, quorum_block_processor, qman, errorRet)) { + if (!BuildSimplifiedMNListDiff(dmnman, chainman, qblockman, qman, GetLastBaseBlockHash(baseBlockIndexes, pWorkBlockHMinus4CIndex), pWorkBlockHMinus4CIndex->GetBlockHash(), mn4c, errorRet)) { return false; } @@ -268,11 +268,11 @@ bool BuildQuorumRotationInfo(const CGetQuorumRotationInfo& request, CQuorumRotat std::set snapshotHeightsNeeded; - std::vector> qdata = quorum_block_processor.GetLastMinedCommitmentsPerQuorumIndexUntilBlock(llmqType, blockIndex, 0); + std::vector> qdata = qblockman.GetLastMinedCommitmentsPerQuorumIndexUntilBlock(llmqType, blockIndex, 0); for (const auto& obj : qdata) { uint256 minedBlockHash; - llmq::CFinalCommitmentPtr qc = quorum_block_processor.GetMinedCommitment(llmqType, obj.second->GetBlockHash(), minedBlockHash); + llmq::CFinalCommitmentPtr qc = qblockman.GetMinedCommitment(llmqType, obj.second->GetBlockHash(), minedBlockHash); if (qc == nullptr) { return false; } @@ -311,7 +311,7 @@ bool BuildQuorumRotationInfo(const CGetQuorumRotationInfo& request, CQuorumRotat } CSimplifiedMNListDiff mnhneeded; - if (!BuildSimplifiedMNListDiff(GetLastBaseBlockHash(baseBlockIndexes, pNeededWorkBlockIndex), pNeededWorkBlockIndex->GetBlockHash(), mnhneeded, dmnman, quorum_block_processor, qman, errorRet)) { + if (!BuildSimplifiedMNListDiff(dmnman, chainman, qblockman, qman, GetLastBaseBlockHash(baseBlockIndexes, pNeededWorkBlockIndex), pNeededWorkBlockIndex->GetBlockHash(), mnhneeded, errorRet)) { return false; } diff --git a/src/llmq/snapshot.h b/src/llmq/snapshot.h index 54a5ad1d7f173..b108e3f8ff2ca 100644 --- a/src/llmq/snapshot.h +++ b/src/llmq/snapshot.h @@ -207,9 +207,9 @@ class CQuorumRotationInfo [[nodiscard]] UniValue ToJson() const; }; -bool BuildQuorumRotationInfo(const CGetQuorumRotationInfo& request, CQuorumRotationInfo& response, - CDeterministicMNManager& dmnman, const ChainstateManager& chainman, const CQuorumManager& qman, - const CQuorumBlockProcessor& quorumBlockProcessor, std::string& errorRet); +bool BuildQuorumRotationInfo(CDeterministicMNManager& dmnman, const ChainstateManager& chainman, const CQuorumManager& qman, + const CQuorumBlockProcessor& qblockman, const CGetQuorumRotationInfo& request, + CQuorumRotationInfo& response, std::string& errorRet); uint256 GetLastBaseBlockHash(Span baseBlockIndexes, const CBlockIndex* blockIndex); class CQuorumSnapshotManager diff --git a/src/net_processing.cpp b/src/net_processing.cpp index b29d0c9306d12..1e003a688d2cd 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -4803,7 +4803,9 @@ void PeerManagerImpl::ProcessMessage( CSimplifiedMNListDiff mnListDiff; std::string strError; - if (BuildSimplifiedMNListDiff(cmd.baseBlockHash, cmd.blockHash, mnListDiff, *m_dmnman, *m_llmq_ctx->quorum_block_processor, *m_llmq_ctx->qman, strError)) { + if (BuildSimplifiedMNListDiff(*m_dmnman, m_chainman, *m_llmq_ctx->quorum_block_processor, *m_llmq_ctx->qman, + cmd.baseBlockHash, cmd.blockHash, mnListDiff, strError)) + { m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::MNLISTDIFF, mnListDiff)); } else { strError = strprintf("getmnlistdiff failed for baseBlockHash=%s, blockHash=%s. error=%s", cmd.baseBlockHash.ToString(), cmd.blockHash.ToString(), strError); @@ -4842,7 +4844,7 @@ void PeerManagerImpl::ProcessMessage( llmq::CQuorumRotationInfo quorumRotationInfoRet; std::string strError; - if (BuildQuorumRotationInfo(cmd, quorumRotationInfoRet, *m_dmnman, m_chainman, *m_llmq_ctx->qman, *m_llmq_ctx->quorum_block_processor, strError)) { + if (BuildQuorumRotationInfo(*m_dmnman, m_chainman, *m_llmq_ctx->qman, *m_llmq_ctx->quorum_block_processor, cmd, quorumRotationInfoRet, strError)) { m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::QUORUMROTATIONINFO, quorumRotationInfoRet)); } else { strError = strprintf("getquorumrotationinfo failed for size(baseBlockHashes)=%d, blockRequestHash=%s. error=%s", cmd.baseBlockHashes.size(), cmd.blockRequestHash.ToString(), strError); @@ -4904,7 +4906,7 @@ void PeerManagerImpl::ProcessMessage( ProcessPeerMsgRet(m_sporkman.ProcessMessage(pfrom, m_connman, *this, msg_type, vRecv), pfrom); m_mn_sync.ProcessMessage(pfrom, msg_type, vRecv); ProcessPeerMsgRet(m_govman.ProcessMessage(pfrom, m_connman, *this, msg_type, vRecv), pfrom); - ProcessPeerMsgRet(CMNAuth::ProcessMessage(pfrom, m_connman, m_mn_metaman, m_mn_activeman, m_mn_sync, m_dmnman->GetListAtChainTip(), msg_type, vRecv), pfrom); + ProcessPeerMsgRet(CMNAuth::ProcessMessage(pfrom, m_connman, m_mn_metaman, m_mn_activeman, m_chainman.ActiveChain(), m_mn_sync, m_dmnman->GetListAtChainTip(), msg_type, vRecv), pfrom); ProcessPeerMsgRet(m_llmq_ctx->quorum_block_processor->ProcessMessage(pfrom, msg_type, vRecv), pfrom); ProcessPeerMsgRet(m_llmq_ctx->qdkgsman->ProcessMessage(pfrom, this, is_masternode, msg_type, vRecv), pfrom); ProcessPeerMsgRet(m_llmq_ctx->qman->ProcessMessage(pfrom, msg_type, vRecv), pfrom); diff --git a/src/rpc/evo.cpp b/src/rpc/evo.cpp index 25c9c89d2a4cf..d2577d5cf978f 100644 --- a/src/rpc/evo.cpp +++ b/src/rpc/evo.cpp @@ -1527,7 +1527,9 @@ static UniValue protx_diff(const JSONRPCRequest& request, CDeterministicMNManage CSimplifiedMNListDiff mnListDiff; std::string strError; - if (!BuildSimplifiedMNListDiff(baseBlockHash, blockHash, mnListDiff, dmnman, *llmq_ctx.quorum_block_processor, *llmq_ctx.qman, strError, extended)) { + if (!BuildSimplifiedMNListDiff(dmnman, chainman, *llmq_ctx.quorum_block_processor, *llmq_ctx.qman, baseBlockHash, + blockHash, mnListDiff, strError, extended)) + { throw std::runtime_error(strError); } diff --git a/src/rpc/quorums.cpp b/src/rpc/quorums.cpp index 20e39bc68bc6e..876c313cadd5e 100644 --- a/src/rpc/quorums.cpp +++ b/src/rpc/quorums.cpp @@ -818,7 +818,7 @@ static RPCHelpMan quorum_rotationinfo() LOCK(cs_main); - if (!BuildQuorumRotationInfo(cmd, quorumRotationInfoRet, *node.dmnman, chainman, *llmq_ctx.qman, *llmq_ctx.quorum_block_processor, strError)) { + if (!BuildQuorumRotationInfo(*node.dmnman, chainman, *llmq_ctx.qman, *llmq_ctx.quorum_block_processor, cmd, quorumRotationInfoRet, strError)) { throw JSONRPCError(RPC_INVALID_REQUEST, strError); } diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index 9de3e65782050..768965d9f58b4 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -119,7 +119,7 @@ void DashTestSetup(NodeContext& node, const CChainParams& chainparams) #endif // ENABLE_WALLET node.llmq_ctx = std::make_unique(chainstate, *node.connman, *node.dmnman, *node.evodb, *node.mn_metaman, *node.mnhf_manager, *node.sporkman, *node.mempool, /* mn_activeman = */ nullptr, *node.mn_sync, node.peerman, /* unit_tests = */ true, /* wipe = */ false); - Assert(node.mnhf_manager)->ConnectManagers(node.llmq_ctx->qman.get()); + Assert(node.mnhf_manager)->ConnectManagers(node.chainman, node.llmq_ctx->qman.get()); node.chain_helper = std::make_unique(*node.cpoolman, *node.dmnman, *node.mnhf_manager, *node.govman, *(node.llmq_ctx->quorum_block_processor), *node.chainman, chainparams.GetConsensus(), *node.mn_sync, *node.sporkman, *(node.llmq_ctx->clhandler), *(node.llmq_ctx->qman)); }