mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
refactor: remove CSporkManager global, move to NodeContext
This commit is contained in:
parent
24ba2f027c
commit
60fd1aa774
20
src/init.cpp
20
src/init.cpp
@ -313,8 +313,7 @@ void PrepareShutdown(NodeContext& node)
|
||||
::dstxManager.reset();
|
||||
node.mn_sync = nullptr;
|
||||
::masternodeSync.reset();
|
||||
node.sporkman = nullptr;
|
||||
::sporkManager.reset();
|
||||
node.sporkman.reset();
|
||||
node.govman = nullptr;
|
||||
::governance.reset();
|
||||
|
||||
@ -1717,15 +1716,8 @@ bool AppInitMain(const CoreContext& context, NodeContext& node, interfaces::Bloc
|
||||
::governance = std::make_unique<CGovernanceManager>();
|
||||
node.govman = ::governance.get();
|
||||
|
||||
assert(!node.peerman);
|
||||
node.peerman = PeerManager::make(chainparams, *node.connman, *node.addrman, node.banman.get(),
|
||||
*node.scheduler, chainman, *node.mempool, *node.govman,
|
||||
node.cj_ctx, node.llmq_ctx, ignores_incoming_txs);
|
||||
RegisterValidationInterface(node.peerman.get());
|
||||
|
||||
assert(!::sporkManager);
|
||||
::sporkManager = std::make_unique<CSporkManager>();
|
||||
node.sporkman = ::sporkManager.get();
|
||||
assert(!node.sporkman);
|
||||
node.sporkman = std::make_unique<CSporkManager>();
|
||||
|
||||
std::vector<std::string> vSporkAddresses;
|
||||
if (args.IsArgSet("-sporkaddr")) {
|
||||
@ -1755,6 +1747,12 @@ bool AppInitMain(const CoreContext& context, NodeContext& node, interfaces::Bloc
|
||||
::masternodeSync = std::make_unique<CMasternodeSync>(*node.connman, *node.govman);
|
||||
node.mn_sync = ::masternodeSync.get();
|
||||
|
||||
assert(!node.peerman);
|
||||
node.peerman = PeerManager::make(chainparams, *node.connman, *node.addrman, node.banman.get(),
|
||||
*node.scheduler, chainman, *node.mempool, *node.govman, *node.sporkman,
|
||||
node.cj_ctx, node.llmq_ctx, ignores_incoming_txs);
|
||||
RegisterValidationInterface(node.peerman.get());
|
||||
|
||||
// sanitize comments per BIP-0014, format user agent and check total size
|
||||
std::vector<std::string> uacomments;
|
||||
|
||||
|
@ -31,11 +31,11 @@ LLMQContext::LLMQContext(CChainState& chainstate, CConnman& connman, CEvoDB& evo
|
||||
qdkgsman{std::make_unique<llmq::CDKGSessionManager>(*bls_worker, chainstate, connman, *dkg_debugman, *quorum_block_processor, sporkman, unit_tests, wipe)},
|
||||
qman{[&]() -> llmq::CQuorumManager* const {
|
||||
assert(llmq::quorumManager == nullptr);
|
||||
llmq::quorumManager = std::make_unique<llmq::CQuorumManager>(*bls_worker, chainstate, connman, *qdkgsman, evo_db, *quorum_block_processor, ::masternodeSync);
|
||||
llmq::quorumManager = std::make_unique<llmq::CQuorumManager>(*bls_worker, chainstate, connman, *qdkgsman, evo_db, *quorum_block_processor, sporkman, ::masternodeSync);
|
||||
return llmq::quorumManager.get();
|
||||
}()},
|
||||
sigman{std::make_unique<llmq::CSigningManager>(connman, *llmq::quorumManager, unit_tests, wipe)},
|
||||
shareman{std::make_unique<llmq::CSigSharesManager>(connman, *llmq::quorumManager, *sigman, peerman)},
|
||||
shareman{std::make_unique<llmq::CSigSharesManager>(connman, *sigman, *llmq::quorumManager, sporkman, peerman)},
|
||||
clhandler{[&]() -> llmq::CChainLocksHandler* const {
|
||||
assert(llmq::chainLocksHandler == nullptr);
|
||||
llmq::chainLocksHandler = std::make_unique<llmq::CChainLocksHandler>(chainstate, connman, *::masternodeSync, *llmq::quorumManager, *sigman, *shareman, sporkman, mempool);
|
||||
|
@ -450,7 +450,7 @@ void CDKGSession::VerifyAndComplain(CDKGPendingMessages& pendingMessages)
|
||||
|
||||
void CDKGSession::VerifyConnectionAndMinProtoVersions() const
|
||||
{
|
||||
if (!IsQuorumPoseEnabled(params.type)) {
|
||||
if (!IsQuorumPoseEnabled(params.type, m_sporkman)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -465,7 +465,7 @@ void CDKGSession::VerifyConnectionAndMinProtoVersions() const
|
||||
protoMap.emplace(verifiedProRegTxHash, pnode->nVersion);
|
||||
});
|
||||
|
||||
bool fShouldAllMembersBeConnected = IsAllMembersConnectedEnabled(params.type);
|
||||
bool fShouldAllMembersBeConnected = IsAllMembersConnectedEnabled(params.type, m_sporkman);
|
||||
for (const auto& m : members) {
|
||||
if (m->dmn->proTxHash == myProTxHash) {
|
||||
continue;
|
||||
|
@ -19,6 +19,7 @@ class UniValue;
|
||||
class CInv;
|
||||
class CConnman;
|
||||
class CDeterministicMN;
|
||||
class CSporkManager;
|
||||
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;
|
||||
|
||||
namespace llmq
|
||||
@ -271,6 +272,7 @@ private:
|
||||
CBLSWorkerCache cache;
|
||||
CDKGSessionManager& dkgManager;
|
||||
CDKGDebugManager& dkgDebugManager;
|
||||
const CSporkManager& m_sporkman;
|
||||
|
||||
const CBlockIndex* m_quorum_base_block_index{nullptr};
|
||||
int quorumIndex{0};
|
||||
@ -311,8 +313,8 @@ private:
|
||||
std::set<uint256> validCommitments GUARDED_BY(invCs);
|
||||
|
||||
public:
|
||||
CDKGSession(const Consensus::LLMQParams& _params, CBLSWorker& _blsWorker, CDKGSessionManager& _dkgManager, CDKGDebugManager& _dkgDebugManager, CConnman& _connman) :
|
||||
params(_params), blsWorker(_blsWorker), cache(_blsWorker), dkgManager(_dkgManager), dkgDebugManager(_dkgDebugManager), connman(_connman) {}
|
||||
CDKGSession(const Consensus::LLMQParams& _params, CBLSWorker& _blsWorker, CDKGSessionManager& _dkgManager, CDKGDebugManager& _dkgDebugManager, CConnman& _connman, const CSporkManager& sporkman) :
|
||||
params(_params), blsWorker(_blsWorker), cache(_blsWorker), dkgManager(_dkgManager), dkgDebugManager(_dkgDebugManager), m_sporkman(sporkman), connman(_connman) {}
|
||||
|
||||
bool Init(gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, Span<CDeterministicMNCPtr> mns, const uint256& _myProTxHash, int _quorumIndex);
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace llmq
|
||||
{
|
||||
|
||||
CDKGSessionHandler::CDKGSessionHandler(CBLSWorker& _blsWorker, CChainState& chainstate, CConnman& _connman, CDKGDebugManager& _dkgDebugManager,
|
||||
CDKGSessionManager& _dkgManager, CQuorumBlockProcessor& _quorumBlockProcessor,
|
||||
CDKGSessionManager& _dkgManager, CQuorumBlockProcessor& _quorumBlockProcessor, const CSporkManager& sporkman,
|
||||
const Consensus::LLMQParams& _params, int _quorumIndex) :
|
||||
blsWorker(_blsWorker),
|
||||
m_chainstate(chainstate),
|
||||
@ -33,9 +33,10 @@ CDKGSessionHandler::CDKGSessionHandler(CBLSWorker& _blsWorker, CChainState& chai
|
||||
dkgDebugManager(_dkgDebugManager),
|
||||
dkgManager(_dkgManager),
|
||||
quorumBlockProcessor(_quorumBlockProcessor),
|
||||
m_sporkman(sporkman),
|
||||
params(_params),
|
||||
quorumIndex(_quorumIndex),
|
||||
curSession(std::make_unique<CDKGSession>(_params, _blsWorker, _dkgManager, _dkgDebugManager, _connman)),
|
||||
curSession(std::make_unique<CDKGSession>(_params, _blsWorker, _dkgManager, _dkgDebugManager, _connman, sporkman)),
|
||||
pendingContributions((size_t)_params.size * 2, MSG_QUORUM_CONTRIB), // we allow size*2 messages as we need to make sure we see bad behavior (double messages)
|
||||
pendingComplaints((size_t)_params.size * 2, MSG_QUORUM_COMPLAINT),
|
||||
pendingJustifications((size_t)_params.size * 2, MSG_QUORUM_JUSTIFICATION),
|
||||
@ -183,7 +184,7 @@ void CDKGSessionHandler::StopThread()
|
||||
|
||||
bool CDKGSessionHandler::InitNewQuorum(const CBlockIndex* pQuorumBaseBlockIndex)
|
||||
{
|
||||
curSession = std::make_unique<CDKGSession>(params, blsWorker, dkgManager, dkgDebugManager, connman);
|
||||
curSession = std::make_unique<CDKGSession>(params, blsWorker, dkgManager, dkgDebugManager, connman, m_sporkman);
|
||||
|
||||
if (!DeploymentDIP0003Enforced(pQuorumBaseBlockIndex->nHeight, Params().GetConsensus())) {
|
||||
return false;
|
||||
@ -526,9 +527,9 @@ void CDKGSessionHandler::HandleDKGRound()
|
||||
return changed;
|
||||
});
|
||||
|
||||
utils::EnsureQuorumConnections(params, pQuorumBaseBlockIndex, connman, curSession->myProTxHash);
|
||||
utils::EnsureQuorumConnections(params, connman, m_sporkman, pQuorumBaseBlockIndex, curSession->myProTxHash);
|
||||
if (curSession->AreWeMember()) {
|
||||
utils::AddQuorumProbeConnections(params, pQuorumBaseBlockIndex, connman, curSession->myProTxHash);
|
||||
utils::AddQuorumProbeConnections(params, connman, m_sporkman, pQuorumBaseBlockIndex, curSession->myProTxHash);
|
||||
}
|
||||
|
||||
WaitForNextPhase(QuorumPhase::Initialized, QuorumPhase::Contribute, curQuorumHash);
|
||||
|
@ -17,6 +17,7 @@
|
||||
class CBlockIndex;
|
||||
class CBLSWorker;
|
||||
class CChainState;
|
||||
class CSporkManager;
|
||||
class PeerManager;
|
||||
|
||||
namespace llmq
|
||||
@ -122,6 +123,7 @@ private:
|
||||
CDKGDebugManager& dkgDebugManager;
|
||||
CDKGSessionManager& dkgManager;
|
||||
CQuorumBlockProcessor& quorumBlockProcessor;
|
||||
const CSporkManager& m_sporkman;
|
||||
const Consensus::LLMQParams params;
|
||||
const int quorumIndex;
|
||||
|
||||
@ -141,7 +143,7 @@ private:
|
||||
|
||||
public:
|
||||
CDKGSessionHandler(CBLSWorker& _blsWorker, CChainState& chainstate, CConnman& _connman, CDKGDebugManager& _dkgDebugManager,
|
||||
CDKGSessionManager& _dkgManager, CQuorumBlockProcessor& _quorumBlockProcessor,
|
||||
CDKGSessionManager& _dkgManager, CQuorumBlockProcessor& _quorumBlockProcessor, const CSporkManager& sporkman,
|
||||
const Consensus::LLMQParams& _params, int _quorumIndex);
|
||||
~CDKGSessionHandler() = default;
|
||||
|
||||
|
@ -25,7 +25,7 @@ static const std::string DB_SKCONTRIB = "qdkg_S";
|
||||
static const std::string DB_ENC_CONTRIB = "qdkg_E";
|
||||
|
||||
CDKGSessionManager::CDKGSessionManager(CBLSWorker& _blsWorker, CChainState& chainstate, CConnman& _connman, CDKGDebugManager& _dkgDebugManager,
|
||||
CQuorumBlockProcessor& _quorumBlockProcessor, CSporkManager& sporkManager,
|
||||
CQuorumBlockProcessor& _quorumBlockProcessor, const CSporkManager& sporkManager,
|
||||
bool unitTests, bool fWipe) :
|
||||
db(std::make_unique<CDBWrapper>(unitTests ? "" : (GetDataDir() / "llmq/dkgdb"), 1 << 20, unitTests, fWipe)),
|
||||
blsWorker(_blsWorker),
|
||||
@ -48,7 +48,7 @@ CDKGSessionManager::CDKGSessionManager(CBLSWorker& _blsWorker, CChainState& chai
|
||||
for (const auto i : irange::range(session_count)) {
|
||||
dkgSessionHandlers.emplace(std::piecewise_construct,
|
||||
std::forward_as_tuple(params.type, i),
|
||||
std::forward_as_tuple(blsWorker, m_chainstate, connman, dkgDebugManager, *this, quorumBlockProcessor, params, i));
|
||||
std::forward_as_tuple(blsWorker, m_chainstate, connman, dkgDebugManager, *this, quorumBlockProcessor, spork_manager, params, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ private:
|
||||
CConnman& connman;
|
||||
CDKGDebugManager& dkgDebugManager;
|
||||
CQuorumBlockProcessor& quorumBlockProcessor;
|
||||
CSporkManager& spork_manager;
|
||||
const CSporkManager& spork_manager;
|
||||
|
||||
//TODO name struct instead of std::pair
|
||||
std::map<std::pair<Consensus::LLMQType, int>, CDKGSessionHandler> dkgSessionHandlers;
|
||||
@ -64,7 +64,7 @@ private:
|
||||
|
||||
public:
|
||||
CDKGSessionManager(CBLSWorker& _blsWorker, CChainState& chainstate, CConnman& _connman, CDKGDebugManager& _dkgDebugManager,
|
||||
CQuorumBlockProcessor& _quorumBlockProcessor, CSporkManager& sporkManager,
|
||||
CQuorumBlockProcessor& _quorumBlockProcessor, const CSporkManager& sporkManager,
|
||||
bool unitTests, bool fWipe);
|
||||
~CDKGSessionManager() = default;
|
||||
|
||||
|
@ -20,7 +20,7 @@ static constexpr int TESTNET_LLMQ_25_67_ACTIVATION_HEIGHT = 847000;
|
||||
namespace llmq
|
||||
{
|
||||
|
||||
static bool EvalSpork(Consensus::LLMQType llmqType, int64_t spork_value)
|
||||
static bool EvalSpork(const Consensus::LLMQType llmqType, const int64_t spork_value)
|
||||
{
|
||||
if (spork_value == 0) {
|
||||
return true;
|
||||
@ -31,14 +31,14 @@ static bool EvalSpork(Consensus::LLMQType llmqType, int64_t spork_value)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsAllMembersConnectedEnabled(Consensus::LLMQType llmqType)
|
||||
bool IsAllMembersConnectedEnabled(const Consensus::LLMQType llmqType, const CSporkManager& sporkman)
|
||||
{
|
||||
return EvalSpork(llmqType, sporkManager->GetSporkValue(SPORK_21_QUORUM_ALL_CONNECTED));
|
||||
return EvalSpork(llmqType, sporkman.GetSporkValue(SPORK_21_QUORUM_ALL_CONNECTED));
|
||||
}
|
||||
|
||||
bool IsQuorumPoseEnabled(Consensus::LLMQType llmqType)
|
||||
bool IsQuorumPoseEnabled(const Consensus::LLMQType llmqType, const CSporkManager& sporkman)
|
||||
{
|
||||
return EvalSpork(llmqType, sporkManager->GetSporkValue(SPORK_23_QUORUM_POSE));
|
||||
return EvalSpork(llmqType, sporkman.GetSporkValue(SPORK_23_QUORUM_POSE));
|
||||
}
|
||||
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <vector>
|
||||
|
||||
class CBlockIndex;
|
||||
class CSporkManager;
|
||||
|
||||
namespace llmq
|
||||
{
|
||||
@ -28,8 +29,8 @@ static constexpr bool DEFAULT_ENABLE_QUORUM_DATA_RECOVERY{true};
|
||||
// If true, we will connect to all new quorums and watch their communication
|
||||
static constexpr bool DEFAULT_WATCH_QUORUMS{false};
|
||||
|
||||
bool IsAllMembersConnectedEnabled(Consensus::LLMQType llmqType);
|
||||
bool IsQuorumPoseEnabled(Consensus::LLMQType llmqType);
|
||||
bool IsAllMembersConnectedEnabled(const Consensus::LLMQType llmqType, const CSporkManager& sporkman);
|
||||
bool IsQuorumPoseEnabled(const Consensus::LLMQType llmqType, const CSporkManager& sporkman);
|
||||
|
||||
bool IsQuorumRotationEnabled(const Consensus::LLMQParams& llmqParams, gsl::not_null<const CBlockIndex*> pindex);
|
||||
|
||||
|
@ -206,13 +206,14 @@ bool CQuorum::ReadContributions(CEvoDB& evoDb)
|
||||
}
|
||||
|
||||
CQuorumManager::CQuorumManager(CBLSWorker& _blsWorker, CChainState& chainstate, CConnman& _connman, CDKGSessionManager& _dkgManager,
|
||||
CEvoDB& _evoDb, CQuorumBlockProcessor& _quorumBlockProcessor, const std::unique_ptr<CMasternodeSync>& mn_sync) :
|
||||
CEvoDB& _evoDb, CQuorumBlockProcessor& _quorumBlockProcessor, const CSporkManager& sporkman, const std::unique_ptr<CMasternodeSync>& mn_sync) :
|
||||
blsWorker(_blsWorker),
|
||||
m_chainstate(chainstate),
|
||||
connman(_connman),
|
||||
dkgManager(_dkgManager),
|
||||
m_evoDb(_evoDb),
|
||||
quorumBlockProcessor(_quorumBlockProcessor),
|
||||
m_sporkman(sporkman),
|
||||
m_mn_sync(mn_sync)
|
||||
{
|
||||
utils::InitQuorumsCache(mapQuorumsCache, false);
|
||||
@ -348,7 +349,7 @@ void CQuorumManager::CheckQuorumConnections(const Consensus::LLMQParams& llmqPar
|
||||
});
|
||||
|
||||
for (const auto& quorum : lastQuorums) {
|
||||
if (utils::EnsureQuorumConnections(llmqParams, quorum->m_quorum_base_block_index, connman, myProTxHash)) {
|
||||
if (utils::EnsureQuorumConnections(llmqParams, connman, m_sporkman, quorum->m_quorum_base_block_index, myProTxHash)) {
|
||||
if (connmanQuorumsToDelete.erase(quorum->qc->quorumHash) > 0) {
|
||||
LogPrint(BCLog::LLMQ, "CQuorumManager::%s -- llmqType[%d] h[%d] keeping mn quorum connections for quorum: [%d:%s]\n", __func__, ToUnderlying(llmqParams.type), pindexNew->nHeight, quorum->m_quorum_base_block_index->nHeight, quorum->m_quorum_base_block_index->GetBlockHash().ToString());
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ class CConnman;
|
||||
class CDeterministicMN;
|
||||
class CMasternodeSync;
|
||||
class CNode;
|
||||
class CSporkManager;
|
||||
|
||||
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;
|
||||
|
||||
@ -220,6 +221,7 @@ private:
|
||||
CDKGSessionManager& dkgManager;
|
||||
CEvoDB& m_evoDb;
|
||||
CQuorumBlockProcessor& quorumBlockProcessor;
|
||||
const CSporkManager& m_sporkman;
|
||||
const std::unique_ptr<CMasternodeSync>& m_mn_sync;
|
||||
|
||||
mutable RecursiveMutex cs_map_quorums;
|
||||
@ -234,7 +236,7 @@ private:
|
||||
|
||||
public:
|
||||
CQuorumManager(CBLSWorker& _blsWorker, CChainState& chainstate, CConnman& _connman, CDKGSessionManager& _dkgManager,
|
||||
CEvoDB& _evoDb, CQuorumBlockProcessor& _quorumBlockProcessor, const std::unique_ptr<CMasternodeSync>& mn_sync);
|
||||
CEvoDB& _evoDb, CQuorumBlockProcessor& _quorumBlockProcessor, const CSporkManager& sporkman, const std::unique_ptr<CMasternodeSync>& mn_sync);
|
||||
~CQuorumManager() { Stop(); };
|
||||
|
||||
void Start();
|
||||
|
@ -698,7 +698,7 @@ void CSigSharesManager::ProcessSigShare(const CSigShare& sigShare, const CConnma
|
||||
|
||||
// prepare node set for direct-push in case this is our sig share
|
||||
std::set<NodeId> quorumNodes;
|
||||
if (!IsAllMembersConnectedEnabled(llmqType) && sigShare.getQuorumMember() == quorum->GetMemberIndex(WITH_LOCK(activeMasternodeInfoCs, return activeMasternodeInfo.proTxHash))) {
|
||||
if (!IsAllMembersConnectedEnabled(llmqType, m_sporkman) && sigShare.getQuorumMember() == quorum->GetMemberIndex(WITH_LOCK(activeMasternodeInfoCs, return activeMasternodeInfo.proTxHash))) {
|
||||
quorumNodes = connman.GetMasternodeQuorumNodes(sigShare.getLlmqType(), sigShare.getQuorumHash());
|
||||
}
|
||||
|
||||
@ -712,7 +712,7 @@ void CSigSharesManager::ProcessSigShare(const CSigShare& sigShare, const CConnma
|
||||
if (!sigShares.Add(sigShare.GetKey(), sigShare)) {
|
||||
return;
|
||||
}
|
||||
if (!IsAllMembersConnectedEnabled(llmqType)) {
|
||||
if (!IsAllMembersConnectedEnabled(llmqType, m_sporkman)) {
|
||||
sigSharesQueuedToAnnounce.Add(sigShare.GetKey(), true);
|
||||
}
|
||||
|
||||
@ -857,7 +857,7 @@ void CSigSharesManager::CollectSigSharesToRequest(std::unordered_map<NodeId, std
|
||||
decltype(sigSharesToRequest.begin()->second)* invMap = nullptr;
|
||||
|
||||
for (auto& [signHash, session] : nodeState.sessions) {
|
||||
if (IsAllMembersConnectedEnabled(session.llmqType)) {
|
||||
if (IsAllMembersConnectedEnabled(session.llmqType, m_sporkman)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -928,7 +928,7 @@ void CSigSharesManager::CollectSigSharesToSend(std::unordered_map<NodeId, std::u
|
||||
decltype(sigSharesToSend.begin()->second)* sigSharesToSend2 = nullptr;
|
||||
|
||||
for (auto& [signHash, session] : nodeState.sessions) {
|
||||
if (IsAllMembersConnectedEnabled(session.llmqType)) {
|
||||
if (IsAllMembersConnectedEnabled(session.llmqType, m_sporkman)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -982,7 +982,7 @@ void CSigSharesManager::CollectSigSharesToSendConcentrated(std::unordered_map<No
|
||||
auto curTime = GetTime<std::chrono::milliseconds>().count();
|
||||
|
||||
for (auto& [_, signedSession] : signedSessions) {
|
||||
if (!IsAllMembersConnectedEnabled(signedSession.quorum->params.type)) {
|
||||
if (!IsAllMembersConnectedEnabled(signedSession.quorum->params.type, m_sporkman)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1474,7 +1474,7 @@ void CSigSharesManager::SignPendingSigShares()
|
||||
auto sigShare = *opt_sigShare;
|
||||
ProcessSigShare(sigShare, connman, pQuorum);
|
||||
|
||||
if (IsAllMembersConnectedEnabled(pQuorum->params.type)) {
|
||||
if (IsAllMembersConnectedEnabled(pQuorum->params.type, m_sporkman)) {
|
||||
LOCK(cs);
|
||||
auto& session = signedSessions[sigShare.GetSignHash()];
|
||||
session.sigShare = sigShare;
|
||||
@ -1528,7 +1528,7 @@ std::optional<CSigShare> CSigSharesManager::CreateSigShare(const CQuorumCPtr& qu
|
||||
// causes all known sigShares to be re-announced
|
||||
void CSigSharesManager::ForceReAnnouncement(const CQuorumCPtr& quorum, Consensus::LLMQType llmqType, const uint256& id, const uint256& msgHash)
|
||||
{
|
||||
if (IsAllMembersConnectedEnabled(llmqType)) {
|
||||
if (IsAllMembersConnectedEnabled(llmqType, m_sporkman)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -400,8 +400,9 @@ private:
|
||||
FastRandomContext rnd GUARDED_BY(cs);
|
||||
|
||||
CConnman& connman;
|
||||
const CQuorumManager& qman;
|
||||
CSigningManager& sigman;
|
||||
const CQuorumManager& qman;
|
||||
const CSporkManager& m_sporkman;
|
||||
|
||||
const std::unique_ptr<PeerManager>& m_peerman;
|
||||
|
||||
@ -409,8 +410,8 @@ private:
|
||||
std::atomic<uint32_t> recoveredSigsCounter{0};
|
||||
|
||||
public:
|
||||
explicit CSigSharesManager(CConnman& _connman, CQuorumManager& _qman, CSigningManager& _sigman, const std::unique_ptr<PeerManager>& peerman) :
|
||||
connman(_connman), qman(_qman), sigman(_sigman), m_peerman(peerman)
|
||||
explicit CSigSharesManager(CConnman& _connman, CSigningManager& _sigman, const CQuorumManager& _qman, const CSporkManager& sporkman, const std::unique_ptr<PeerManager>& peerman) :
|
||||
connman(_connman), sigman(_sigman), qman(_qman), m_sporkman(sporkman), m_peerman(peerman)
|
||||
{
|
||||
workInterrupt.reset();
|
||||
};
|
||||
|
@ -649,10 +649,10 @@ uint256 DeterministicOutboundConnection(const uint256& proTxHash1, const uint256
|
||||
return proTxHash2;
|
||||
}
|
||||
|
||||
std::set<uint256> GetQuorumConnections(const Consensus::LLMQParams& llmqParams, gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex,
|
||||
const uint256& forMember, bool onlyOutbound)
|
||||
std::set<uint256> GetQuorumConnections(const Consensus::LLMQParams& llmqParams, const CSporkManager& sporkman,
|
||||
gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, const uint256& forMember, bool onlyOutbound)
|
||||
{
|
||||
if (IsAllMembersConnectedEnabled(llmqParams.type)) {
|
||||
if (IsAllMembersConnectedEnabled(llmqParams.type, sporkman)) {
|
||||
auto mns = GetAllQuorumMembers(llmqParams.type, pQuorumBaseBlockIndex);
|
||||
std::set<uint256> result;
|
||||
|
||||
@ -749,8 +749,8 @@ std::set<size_t> CalcDeterministicWatchConnections(Consensus::LLMQType llmqType,
|
||||
return result;
|
||||
}
|
||||
|
||||
bool EnsureQuorumConnections(const Consensus::LLMQParams& llmqParams, gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex,
|
||||
CConnman& connman, const uint256& myProTxHash)
|
||||
bool EnsureQuorumConnections(const Consensus::LLMQParams& llmqParams, CConnman& connman, const CSporkManager& sporkman,
|
||||
gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, const uint256& myProTxHash)
|
||||
{
|
||||
if (!fMasternodeMode && !IsWatchQuorumsEnabled()) {
|
||||
return false;
|
||||
@ -773,7 +773,7 @@ bool EnsureQuorumConnections(const Consensus::LLMQParams& llmqParams, gsl::not_n
|
||||
std::set<uint256> connections;
|
||||
std::set<uint256> relayMembers;
|
||||
if (isMember) {
|
||||
connections = GetQuorumConnections(llmqParams, pQuorumBaseBlockIndex, myProTxHash, true);
|
||||
connections = GetQuorumConnections(llmqParams, sporkman, pQuorumBaseBlockIndex, myProTxHash, true);
|
||||
relayMembers = GetQuorumRelayMembers(llmqParams, pQuorumBaseBlockIndex, myProTxHash, true);
|
||||
} else {
|
||||
auto cindexes = CalcDeterministicWatchConnections(llmqParams.type, pQuorumBaseBlockIndex, members.size(), 1);
|
||||
@ -804,10 +804,10 @@ bool EnsureQuorumConnections(const Consensus::LLMQParams& llmqParams, gsl::not_n
|
||||
return true;
|
||||
}
|
||||
|
||||
void AddQuorumProbeConnections(const Consensus::LLMQParams& llmqParams, gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex,
|
||||
CConnman& connman, const uint256 &myProTxHash)
|
||||
void AddQuorumProbeConnections(const Consensus::LLMQParams& llmqParams, CConnman& connman, const CSporkManager& sporkman,
|
||||
gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, const uint256 &myProTxHash)
|
||||
{
|
||||
if (!IsQuorumPoseEnabled(llmqParams.type)) {
|
||||
if (!IsQuorumPoseEnabled(llmqParams.type, sporkman)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ class CBlockIndex;
|
||||
class CDeterministicMN;
|
||||
class CDeterministicMNList;
|
||||
using CDeterministicMNCPtr = std::shared_ptr<const CDeterministicMN>;
|
||||
class CSporkManager;
|
||||
|
||||
namespace llmq
|
||||
{
|
||||
@ -30,12 +31,12 @@ namespace utils
|
||||
std::vector<CDeterministicMNCPtr> GetAllQuorumMembers(Consensus::LLMQType llmqType, gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, bool reset_cache = false);
|
||||
|
||||
uint256 DeterministicOutboundConnection(const uint256& proTxHash1, const uint256& proTxHash2);
|
||||
std::set<uint256> GetQuorumConnections(const Consensus::LLMQParams& llmqParams, gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, const uint256& forMember, bool onlyOutbound);
|
||||
std::set<uint256> GetQuorumConnections(const Consensus::LLMQParams& llmqParams, const CSporkManager& sporkman, gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, const uint256& forMember, bool onlyOutbound);
|
||||
std::set<uint256> GetQuorumRelayMembers(const Consensus::LLMQParams& llmqParams, gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, const uint256& forMember, bool onlyOutbound);
|
||||
std::set<size_t> CalcDeterministicWatchConnections(Consensus::LLMQType llmqType, gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, size_t memberCount, size_t connectionCount);
|
||||
|
||||
bool EnsureQuorumConnections(const Consensus::LLMQParams& llmqParams, gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, CConnman& connman, const uint256& myProTxHash);
|
||||
void AddQuorumProbeConnections(const Consensus::LLMQParams& llmqParams, gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, CConnman& connman, const uint256& myProTxHash);
|
||||
bool EnsureQuorumConnections(const Consensus::LLMQParams& llmqParams, CConnman& connman, const CSporkManager& sporkman, gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, const uint256& myProTxHash);
|
||||
void AddQuorumProbeConnections(const Consensus::LLMQParams& llmqParams, CConnman& connman, const CSporkManager& sporkman, gsl::not_null<const CBlockIndex*> pQuorumBaseBlockIndex, const uint256& myProTxHash);
|
||||
|
||||
template <typename CacheType>
|
||||
void InitQuorumsCache(CacheType& cache, bool limit_by_connections = true);
|
||||
|
@ -238,7 +238,8 @@ class PeerManagerImpl final : public PeerManager
|
||||
public:
|
||||
PeerManagerImpl(const CChainParams& chainparams, CConnman& connman, CAddrMan& addrman,
|
||||
BanMan* banman, CScheduler &scheduler, ChainstateManager& chainman,
|
||||
CTxMemPool& pool, CGovernanceManager& govman, const std::unique_ptr<CJContext>& cj_ctx,
|
||||
CTxMemPool& pool, CGovernanceManager& govman, CSporkManager& sporkman,
|
||||
const std::unique_ptr<CJContext>& cj_ctx,
|
||||
const std::unique_ptr<LLMQContext>& llmq_ctx, bool ignore_incoming_txs);
|
||||
|
||||
/** Overridden from CValidationInterface. */
|
||||
@ -335,6 +336,7 @@ private:
|
||||
const std::unique_ptr<CJContext>& m_cj_ctx;
|
||||
const std::unique_ptr<LLMQContext>& m_llmq_ctx;
|
||||
CGovernanceManager& m_govman;
|
||||
CSporkManager& m_sporkman;
|
||||
|
||||
/** The height of the best chain */
|
||||
std::atomic<int> m_best_height{-1};
|
||||
@ -1587,15 +1589,16 @@ bool PeerManagerImpl::BlockRequestAllowed(const CBlockIndex* pindex, const Conse
|
||||
|
||||
std::unique_ptr<PeerManager> PeerManager::make(const CChainParams& chainparams, CConnman& connman, CAddrMan& addrman, BanMan* banman,
|
||||
CScheduler &scheduler, ChainstateManager& chainman, CTxMemPool& pool,
|
||||
CGovernanceManager& govman, const std::unique_ptr<CJContext>& cj_ctx,
|
||||
CGovernanceManager& govman, CSporkManager& sporkman,
|
||||
const std::unique_ptr<CJContext>& cj_ctx,
|
||||
const std::unique_ptr<LLMQContext>& llmq_ctx, bool ignore_incoming_txs)
|
||||
{
|
||||
return std::make_unique<PeerManagerImpl>(chainparams, connman, addrman, banman, scheduler, chainman, pool, govman, cj_ctx, llmq_ctx, ignore_incoming_txs);
|
||||
return std::make_unique<PeerManagerImpl>(chainparams, connman, addrman, banman, scheduler, chainman, pool, govman, sporkman, cj_ctx, llmq_ctx, ignore_incoming_txs);
|
||||
}
|
||||
|
||||
PeerManagerImpl::PeerManagerImpl(const CChainParams& chainparams, CConnman& connman, CAddrMan& addrman, BanMan* banman,
|
||||
CScheduler &scheduler, ChainstateManager& chainman, CTxMemPool& pool,
|
||||
CGovernanceManager& govman, const std::unique_ptr<CJContext>& cj_ctx,
|
||||
CGovernanceManager& govman, CSporkManager& sporkman, const std::unique_ptr<CJContext>& cj_ctx,
|
||||
const std::unique_ptr<LLMQContext>& llmq_ctx, bool ignore_incoming_txs)
|
||||
: m_chainparams(chainparams),
|
||||
m_connman(connman),
|
||||
@ -1606,6 +1609,7 @@ PeerManagerImpl::PeerManagerImpl(const CChainParams& chainparams, CConnman& conn
|
||||
m_cj_ctx(cj_ctx),
|
||||
m_llmq_ctx(llmq_ctx),
|
||||
m_govman(govman),
|
||||
m_sporkman(sporkman),
|
||||
m_ignore_incoming_txs(ignore_incoming_txs)
|
||||
{
|
||||
assert(std::addressof(g_chainman) == std::addressof(m_chainman));
|
||||
@ -1884,7 +1888,7 @@ bool PeerManagerImpl::AlreadyHave(const CInv& inv)
|
||||
|
||||
case MSG_SPORK:
|
||||
{
|
||||
return sporkManager->GetSporkByHash(inv.hash).has_value();
|
||||
return m_sporkman.GetSporkByHash(inv.hash).has_value();
|
||||
}
|
||||
|
||||
case MSG_GOVERNANCE_OBJECT:
|
||||
@ -2220,7 +2224,7 @@ void PeerManagerImpl::ProcessGetData(CNode& pfrom, Peer& peer, const std::atomic
|
||||
}
|
||||
|
||||
if (!push && inv.type == MSG_SPORK) {
|
||||
if (auto opt_spork = sporkManager->GetSporkByHash(inv.hash)) {
|
||||
if (auto opt_spork = m_sporkman.GetSporkByHash(inv.hash)) {
|
||||
m_connman.PushMessage(&pfrom, msgMaker.Make(NetMsgType::SPORK, *opt_spork));
|
||||
push = true;
|
||||
}
|
||||
@ -4429,14 +4433,14 @@ void PeerManagerImpl::ProcessMessage(
|
||||
}
|
||||
#endif // ENABLE_WALLET
|
||||
ProcessPeerMsgRet(m_cj_ctx->server->ProcessMessage(pfrom, msg_type, vRecv), pfrom);
|
||||
ProcessPeerMsgRet(sporkManager->ProcessMessage(pfrom, m_connman, msg_type, vRecv), pfrom);
|
||||
ProcessPeerMsgRet(m_sporkman.ProcessMessage(pfrom, m_connman, msg_type, vRecv), pfrom);
|
||||
::masternodeSync->ProcessMessage(pfrom, msg_type, vRecv);
|
||||
ProcessPeerMsgRet(m_govman.ProcessMessage(pfrom, m_connman, msg_type, vRecv), pfrom);
|
||||
ProcessPeerMsgRet(CMNAuth::ProcessMessage(pfrom, m_connman, 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, msg_type, vRecv), pfrom);
|
||||
ProcessPeerMsgRet(m_llmq_ctx->qman->ProcessMessage(pfrom, msg_type, vRecv), pfrom);
|
||||
m_llmq_ctx->shareman->ProcessMessage(pfrom, *sporkManager, msg_type, vRecv);
|
||||
m_llmq_ctx->shareman->ProcessMessage(pfrom, m_sporkman, msg_type, vRecv);
|
||||
ProcessPeerMsgRet(m_llmq_ctx->sigman->ProcessMessage(pfrom, this, msg_type, vRecv), pfrom);
|
||||
ProcessPeerMsgRet(m_llmq_ctx->clhandler->ProcessMessage(pfrom, msg_type, vRecv), pfrom);
|
||||
ProcessPeerMsgRet(m_llmq_ctx->isman->ProcessMessage(pfrom, this, msg_type, vRecv), pfrom);
|
||||
|
@ -16,9 +16,10 @@ class CAddrMan;
|
||||
class CTxMemPool;
|
||||
class ChainstateManager;
|
||||
class CCoinJoinServer;
|
||||
class CGovernanceManager;
|
||||
class CSporkManager;
|
||||
struct CJContext;
|
||||
struct LLMQContext;
|
||||
class CGovernanceManager;
|
||||
|
||||
extern RecursiveMutex cs_main;
|
||||
extern RecursiveMutex g_cs_orphans;
|
||||
@ -42,7 +43,8 @@ class PeerManager : public CValidationInterface, public NetEventsInterface
|
||||
public:
|
||||
static std::unique_ptr<PeerManager> make(const CChainParams& chainparams, CConnman& connman, CAddrMan& addrman,
|
||||
BanMan* banman, CScheduler &scheduler, ChainstateManager& chainman,
|
||||
CTxMemPool& pool, CGovernanceManager& govman, const std::unique_ptr<CJContext>& cj_ctx,
|
||||
CTxMemPool& pool, CGovernanceManager& govman, CSporkManager& sporkman,
|
||||
const std::unique_ptr<CJContext>& cj_ctx,
|
||||
const std::unique_ptr<LLMQContext>& llmq_ctx, bool ignore_incoming_txs);
|
||||
virtual ~PeerManager() { }
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <net_processing.h>
|
||||
#include <policy/fees.h>
|
||||
#include <scheduler.h>
|
||||
#include <spork.h>
|
||||
#include <txmempool.h>
|
||||
|
||||
NodeContext::NodeContext() {}
|
||||
|
@ -75,6 +75,7 @@ struct NodeContext {
|
||||
std::unique_ptr<CChainstateHelper> chain_helper;
|
||||
std::unique_ptr<CJContext> cj_ctx;
|
||||
std::unique_ptr<CMNHFManager> mnhf_manager;
|
||||
std::unique_ptr<CSporkManager> sporkman;
|
||||
std::unique_ptr<LLMQContext> llmq_ctx;
|
||||
CCreditPoolManager* cpoolman{nullptr};
|
||||
CDeterministicMNManager* dmnman{nullptr};
|
||||
@ -83,7 +84,6 @@ struct NodeContext {
|
||||
CMasternodeMetaMan* mn_metaman{nullptr};
|
||||
CMasternodeSync* mn_sync{nullptr};
|
||||
CNetFulfilledRequestManager* netfulfilledman{nullptr};
|
||||
CSporkManager* sporkman{nullptr};
|
||||
|
||||
//! Declare default constructor and destructor that are not inline, so code
|
||||
//! instantiating the NodeContext struct doesn't need to #include class
|
||||
|
@ -275,7 +275,7 @@ static void quorum_dkgstatus_help(const JSONRPCRequest& request)
|
||||
}.Check(request);
|
||||
}
|
||||
|
||||
static UniValue quorum_dkgstatus(const JSONRPCRequest& request, const ChainstateManager& chainman, const LLMQContext& llmq_ctx)
|
||||
static UniValue quorum_dkgstatus(const JSONRPCRequest& request, const ChainstateManager& chainman, const CSporkManager& sporkman, const LLMQContext& llmq_ctx)
|
||||
{
|
||||
quorum_dkgstatus_help(request);
|
||||
|
||||
@ -319,11 +319,8 @@ static UniValue quorum_dkgstatus(const JSONRPCRequest& request, const Chainstate
|
||||
obj.pushKV("quorumHash", pQuorumBaseBlockIndex->GetBlockHash().ToString());
|
||||
obj.pushKV("pindexTip", pindexTip->nHeight);
|
||||
|
||||
auto allConnections = llmq::utils::GetQuorumConnections(llmq_params, pQuorumBaseBlockIndex,
|
||||
proTxHash, false);
|
||||
auto outboundConnections = llmq::utils::GetQuorumConnections(llmq_params,
|
||||
pQuorumBaseBlockIndex, proTxHash,
|
||||
true);
|
||||
auto allConnections = llmq::utils::GetQuorumConnections(llmq_params, sporkman, pQuorumBaseBlockIndex, proTxHash, false);
|
||||
auto outboundConnections = llmq::utils::GetQuorumConnections(llmq_params, sporkman, pQuorumBaseBlockIndex, proTxHash, true);
|
||||
std::map<uint256, CAddress> foundConnections;
|
||||
const NodeContext& node = EnsureAnyNodeContext(request.context);
|
||||
node.connman->ForEachNode([&](const CNode* pnode) {
|
||||
@ -882,7 +879,7 @@ static UniValue _quorum(const JSONRPCRequest& request)
|
||||
} else if (command == "quorumdkginfo") {
|
||||
return quorum_dkginfo(new_request, llmq_ctx, chainman);
|
||||
} else if (command == "quorumdkgstatus") {
|
||||
return quorum_dkgstatus(new_request, chainman, llmq_ctx);
|
||||
return quorum_dkgstatus(new_request, chainman, *node.sporkman, llmq_ctx);
|
||||
} else if (command == "quorummemberof") {
|
||||
return quorum_memberof(new_request, chainman, node, llmq_ctx);
|
||||
} else if (command == "quorumsign" || command == "quorumverify" || command == "quorumhasrecsig" || command == "quorumgetrecsig" || command == "quorumisconflicting") {
|
||||
|
@ -23,8 +23,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
std::unique_ptr<CSporkManager> sporkManager;
|
||||
|
||||
const std::string SporkStore::SERIALIZATION_VERSION_STRING = "CSporkManager-Version-2";
|
||||
|
||||
std::optional<SporkValue> CSporkManager::SporkValueIfActive(SporkId nSporkID) const
|
||||
|
@ -78,7 +78,6 @@ struct CSporkDef
|
||||
MAKE_SPORK_DEF(SPORK_24_TEST_EHF, 4070908800ULL), // OFF
|
||||
};
|
||||
#undef MAKE_SPORK_DEF
|
||||
extern std::unique_ptr<CSporkManager> sporkManager;
|
||||
|
||||
/**
|
||||
* Sporks are network parameters used primarily to prevent forking and turn
|
||||
|
@ -65,7 +65,7 @@ BOOST_AUTO_TEST_CASE(outbound_slow_chain_eviction)
|
||||
const CChainParams& chainparams = Params();
|
||||
auto connman = std::make_unique<CConnman>(0x1337, 0x1337, *m_node.addrman);
|
||||
auto peerLogic = PeerManager::make(chainparams, *connman, *m_node.addrman, nullptr, *m_node.scheduler,
|
||||
*m_node.chainman, *m_node.mempool, *m_node.govman, m_node.cj_ctx,
|
||||
*m_node.chainman, *m_node.mempool, *m_node.govman, *m_node.sporkman, m_node.cj_ctx,
|
||||
m_node.llmq_ctx, false);
|
||||
|
||||
// Mock an outbound peer
|
||||
@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE(stale_tip_peer_management)
|
||||
const CChainParams& chainparams = Params();
|
||||
auto connman = std::make_unique<ConnmanTestMsg>(0x1337, 0x1337, *m_node.addrman);
|
||||
auto peerLogic = PeerManager::make(chainparams, *connman, *m_node.addrman, nullptr, *m_node.scheduler,
|
||||
*m_node.chainman, *m_node.mempool, *m_node.govman, m_node.cj_ctx,
|
||||
*m_node.chainman, *m_node.mempool, *m_node.govman, *m_node.sporkman, m_node.cj_ctx,
|
||||
m_node.llmq_ctx, false);
|
||||
|
||||
constexpr int max_outbound_full_relay = MAX_OUTBOUND_FULL_RELAY_CONNECTIONS;
|
||||
@ -210,7 +210,7 @@ BOOST_AUTO_TEST_CASE(DoS_banning)
|
||||
auto banman = std::make_unique<BanMan>(GetDataDir() / "banlist", nullptr, DEFAULT_MISBEHAVING_BANTIME);
|
||||
auto connman = std::make_unique<CConnman>(0x1337, 0x1337, *m_node.addrman);
|
||||
auto peerLogic = PeerManager::make(chainparams, *connman, *m_node.addrman, banman.get(), *m_node.scheduler,
|
||||
*m_node.chainman, *m_node.mempool, *m_node.govman, m_node.cj_ctx,
|
||||
*m_node.chainman, *m_node.mempool, *m_node.govman, *m_node.sporkman, m_node.cj_ctx,
|
||||
m_node.llmq_ctx, false);
|
||||
|
||||
banman->ClearBanned();
|
||||
@ -256,7 +256,7 @@ BOOST_AUTO_TEST_CASE(DoS_banscore)
|
||||
auto banman = std::make_unique<BanMan>(GetDataDir() / "banlist", nullptr, DEFAULT_MISBEHAVING_BANTIME);
|
||||
auto connman = std::make_unique<CConnman>(0x1337, 0x1337, *m_node.addrman);
|
||||
auto peerLogic = PeerManager::make(chainparams, *connman, *m_node.addrman, banman.get(), *m_node.scheduler,
|
||||
*m_node.chainman, *m_node.mempool, *m_node.govman, m_node.cj_ctx,
|
||||
*m_node.chainman, *m_node.mempool, *m_node.govman, *m_node.sporkman, m_node.cj_ctx,
|
||||
m_node.llmq_ctx, false);
|
||||
|
||||
banman->ClearBanned();
|
||||
@ -301,7 +301,7 @@ BOOST_AUTO_TEST_CASE(DoS_bantime)
|
||||
auto banman = std::make_unique<BanMan>(GetDataDir() / "banlist", nullptr, DEFAULT_MISBEHAVING_BANTIME);
|
||||
auto connman = std::make_unique<CConnman>(0x1337, 0x1337, *m_node.addrman);
|
||||
auto peerLogic = PeerManager::make(chainparams, *connman, *m_node.addrman, banman.get(), *m_node.scheduler,
|
||||
*m_node.chainman, *m_node.mempool, *m_node.govman, m_node.cj_ctx,
|
||||
*m_node.chainman, *m_node.mempool, *m_node.govman, *m_node.sporkman, m_node.cj_ctx,
|
||||
m_node.llmq_ctx, false);
|
||||
|
||||
banman->ClearBanned();
|
||||
|
@ -222,8 +222,7 @@ ChainTestingSetup::ChainTestingSetup(const std::string& chainName, const std::ve
|
||||
|
||||
m_node.connman = std::make_unique<CConnman>(0x1337, 0x1337, *m_node.addrman); // Deterministic randomness for tests.
|
||||
|
||||
::sporkManager = std::make_unique<CSporkManager>();
|
||||
m_node.sporkman = ::sporkManager.get();
|
||||
m_node.sporkman = std::make_unique<CSporkManager>();
|
||||
::governance = std::make_unique<CGovernanceManager>();
|
||||
m_node.govman = ::governance.get();
|
||||
::masternodeSync = std::make_unique<CMasternodeSync>(*m_node.connman, *m_node.govman);
|
||||
@ -257,8 +256,7 @@ ChainTestingSetup::~ChainTestingSetup()
|
||||
::masternodeSync.reset();
|
||||
m_node.govman = nullptr;
|
||||
::governance.reset();
|
||||
m_node.sporkman = nullptr;
|
||||
::sporkManager.reset();
|
||||
m_node.sporkman.reset();
|
||||
m_node.connman.reset();
|
||||
m_node.addrman.reset();
|
||||
m_node.args = nullptr;
|
||||
@ -291,7 +289,7 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
|
||||
m_node.banman = std::make_unique<BanMan>(GetDataDir() / "banlist", nullptr, DEFAULT_MISBEHAVING_BANTIME);
|
||||
m_node.peerman = PeerManager::make(chainparams, *m_node.connman, *m_node.addrman, m_node.banman.get(),
|
||||
*m_node.scheduler, *m_node.chainman, *m_node.mempool, *m_node.govman,
|
||||
m_node.cj_ctx, m_node.llmq_ctx, false);
|
||||
*m_node.sporkman, m_node.cj_ctx, m_node.llmq_ctx, false);
|
||||
{
|
||||
CConnman::Options options;
|
||||
options.m_msgproc = m_node.peerman.get();
|
||||
|
Loading…
Reference in New Issue
Block a user