mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 03:52:49 +01:00
refactor: drop dependency of EhfSignals on PeerManager
This commit is contained in:
parent
1d13f010d0
commit
d0f17788fc
@ -36,7 +36,8 @@ LLMQContext::LLMQContext(CChainState& chainstate, CConnman& connman, CDeterminis
|
||||
shareman{std::make_unique<llmq::CSigSharesManager>(connman, *sigman, mn_activeman, *qman, sporkman, peerman)},
|
||||
clhandler{[&]() -> llmq::CChainLocksHandler* const {
|
||||
assert(llmq::chainLocksHandler == nullptr);
|
||||
llmq::chainLocksHandler = std::make_unique<llmq::CChainLocksHandler>(chainstate, *qman, *sigman, *shareman, sporkman, mempool, mn_sync, is_masternode);
|
||||
llmq::chainLocksHandler = std::make_unique<llmq::CChainLocksHandler>(chainstate, *qman, *sigman, *shareman,
|
||||
sporkman, mempool, mn_sync, is_masternode);
|
||||
return llmq::chainLocksHandler.get();
|
||||
}()},
|
||||
isman{[&]() -> llmq::CInstantSendManager* const {
|
||||
@ -45,7 +46,7 @@ LLMQContext::LLMQContext(CChainState& chainstate, CConnman& connman, CDeterminis
|
||||
return llmq::quorumInstantSendManager.get();
|
||||
}()},
|
||||
ehfSignalsHandler{
|
||||
std::make_unique<llmq::CEHFSignalsHandler>(chainstate, mnhfman, *sigman, *shareman, mempool, *qman, peerman)}
|
||||
std::make_unique<llmq::CEHFSignalsHandler>(chainstate, mnhfman, *sigman, *shareman, mempool, *qman)}
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <consensus/validation.h>
|
||||
#include <deploymentstatus.h>
|
||||
#include <index/txindex.h> // g_txindex
|
||||
#include <net_processing.h>
|
||||
#include <primitives/transaction.h>
|
||||
#include <txmempool.h>
|
||||
#include <validation.h>
|
||||
@ -23,15 +22,13 @@ namespace llmq {
|
||||
|
||||
|
||||
CEHFSignalsHandler::CEHFSignalsHandler(CChainState& chainstate, CMNHFManager& mnhfman, CSigningManager& sigman,
|
||||
CSigSharesManager& shareman, CTxMemPool& mempool, const CQuorumManager& qman,
|
||||
const std::unique_ptr<PeerManager>& peerman) :
|
||||
CSigSharesManager& shareman, CTxMemPool& mempool, const CQuorumManager& qman) :
|
||||
chainstate(chainstate),
|
||||
mnhfman(mnhfman),
|
||||
sigman(sigman),
|
||||
shareman(shareman),
|
||||
mempool(mempool),
|
||||
qman(qman),
|
||||
m_peerman(peerman)
|
||||
qman(qman)
|
||||
{
|
||||
sigman.RegisterRecoveredSigsListener(this);
|
||||
}
|
||||
@ -105,6 +102,7 @@ MessageProcessingResult CEHFSignalsHandler::HandleNewRecoveredSig(const CRecover
|
||||
return {};
|
||||
}
|
||||
|
||||
MessageProcessingResult ret;
|
||||
const auto ehfSignals = mnhfman.GetSignalsStage(WITH_LOCK(cs_main, return chainstate.m_chain.Tip()));
|
||||
MNHFTxPayload mnhfPayload;
|
||||
for (const auto& deployment : Params().GetConsensus().vDeployments) {
|
||||
@ -130,13 +128,13 @@ MessageProcessingResult CEHFSignalsHandler::HandleNewRecoveredSig(const CRecover
|
||||
LOCK(cs_main);
|
||||
const MempoolAcceptResult result = AcceptToMemoryPool(chainstate, mempool, tx_to_sent, /* bypass_limits */ false);
|
||||
if (result.m_result_type == MempoolAcceptResult::ResultType::VALID) {
|
||||
Assert(m_peerman)->RelayTransaction(tx_to_sent->GetHash());
|
||||
ret.m_transactions.push_back(tx_to_sent->GetHash());
|
||||
} else {
|
||||
LogPrintf("CEHFSignalsHandler::HandleNewRecoveredSig -- AcceptToMemoryPool failed: %s\n", result.m_state.ToString());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return {};
|
||||
return ret;
|
||||
}
|
||||
} // namespace llmq
|
||||
|
@ -13,7 +13,6 @@ class CBlockIndex;
|
||||
class CChainState;
|
||||
class CMNHFManager;
|
||||
class CTxMemPool;
|
||||
class PeerManager;
|
||||
|
||||
namespace llmq
|
||||
{
|
||||
@ -30,7 +29,6 @@ private:
|
||||
CSigSharesManager& shareman;
|
||||
CTxMemPool& mempool;
|
||||
const CQuorumManager& qman;
|
||||
const std::unique_ptr<PeerManager>& m_peerman;
|
||||
|
||||
/**
|
||||
* keep freshly generated IDs for easier filter sigs in HandleNewRecoveredSig
|
||||
@ -39,8 +37,8 @@ private:
|
||||
std::set<uint256> ids GUARDED_BY(cs);
|
||||
public:
|
||||
explicit CEHFSignalsHandler(CChainState& chainstate, CMNHFManager& mnhfman, CSigningManager& sigman,
|
||||
CSigSharesManager& shareman, CTxMemPool& mempool, const CQuorumManager& qman,
|
||||
const std::unique_ptr<PeerManager>& peerman);
|
||||
CSigSharesManager& shareman, CTxMemPool& mempool, const CQuorumManager& qman);
|
||||
|
||||
~CEHFSignalsHandler();
|
||||
|
||||
|
||||
|
@ -3318,6 +3318,9 @@ void PeerManagerImpl::PostProcessMessage(MessageProcessingResult&& result, NodeI
|
||||
if (result.m_to_erase) {
|
||||
WITH_LOCK(cs_main, EraseObjectRequest(node, result.m_to_erase.value()));
|
||||
}
|
||||
for (const auto& tx : result.m_transactions) {
|
||||
WITH_LOCK(cs_main, RelayTransaction(tx));
|
||||
}
|
||||
if (result.m_inventory) {
|
||||
RelayInv(result.m_inventory.value(), MIN_PEER_PROTO_VERSION);
|
||||
}
|
||||
|
@ -585,6 +585,7 @@ struct MessageProcessingResult
|
||||
{
|
||||
std::optional<MisbehavingError> m_error;
|
||||
std::optional<CInv> m_inventory;
|
||||
std::vector<uint256> m_transactions;
|
||||
std::optional<CInv> m_to_erase;
|
||||
|
||||
MessageProcessingResult() = default;
|
||||
|
@ -88,7 +88,7 @@ EXPECTED_CIRCULAR_DEPENDENCIES=(
|
||||
"coinjoin/client -> net_processing -> coinjoin/context -> coinjoin/client"
|
||||
"coinjoin/context -> coinjoin/server -> net_processing -> coinjoin/context"
|
||||
"coinjoin/server -> net_processing -> coinjoin/server"
|
||||
"llmq/context -> llmq/ehf_signals -> net_processing -> llmq/context"
|
||||
"llmq/context -> llmq/instantsend -> net_processing -> llmq/context"
|
||||
"llmq/chainlocks -> llmq/instantsend -> net_processing -> llmq/chainlocks"
|
||||
"net_processing -> spork -> net_processing"
|
||||
"governance/governance -> net_processing -> governance/governance"
|
||||
|
Loading…
Reference in New Issue
Block a user