Skip to content

Commit

Permalink
refactor: make peerman simply a reference
Browse files Browse the repository at this point in the history
  • Loading branch information
PastaPastaPasta authored and UdjinM6 committed Dec 19, 2023
1 parent ad101ca commit e1a4cec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/llmq/chainlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ std::unique_ptr<CChainLocksHandler> chainLocksHandler;

CChainLocksHandler::CChainLocksHandler(CChainState& chainstate, CConnman& _connman, CMasternodeSync& mn_sync, CQuorumManager& _qman,
CSigningManager& _sigman, CSigSharesManager& _shareman, CSporkManager& sporkManager,
CTxMemPool& _mempool, const std::unique_ptr<PeerManager>& peerman) :
CTxMemPool& _mempool, PeerManager& peerman) :
m_chainstate(chainstate),
connman(_connman),
m_mn_sync(mn_sync),
Expand Down Expand Up @@ -131,7 +131,7 @@ void CChainLocksHandler::ProcessNewChainLock(const NodeId from, const llmq::CCha
if (!VerifyChainLock(clsig)) {
LogPrint(BCLog::CHAINLOCKS, "CChainLocksHandler::%s -- invalid CLSIG (%s), peer=%d\n", __func__, clsig.ToString(), from);
if (from != -1) {
m_peerman->Misbehaving(from, 10);
m_peerman.Misbehaving(from, 10);
}
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/llmq/chainlocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CChainLocksHandler : public CRecoveredSigsListener
CSigSharesManager& shareman;
CSporkManager& spork_manager;
CTxMemPool& mempool;
const std::unique_ptr<PeerManager>& m_peerman;
PeerManager& m_peerman;

std::unique_ptr<CScheduler> scheduler;
std::unique_ptr<std::thread> scheduler_thread;
Expand Down Expand Up @@ -89,7 +89,7 @@ class CChainLocksHandler : public CRecoveredSigsListener
public:
explicit CChainLocksHandler(CChainState& chainstate, CConnman& _connman, CMasternodeSync& mn_sync, CQuorumManager& _qman,
CSigningManager& _sigman, CSigSharesManager& _shareman, CSporkManager& sporkManager,
CTxMemPool& _mempool, const std::unique_ptr<PeerManager>& peerman);
CTxMemPool& _mempool, PeerManager& peerman);
~CChainLocksHandler();

void Start();
Expand Down
2 changes: 1 addition & 1 deletion src/llmq/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ LLMQContext::LLMQContext(CChainState& chainstate, CConnman& connman, CEvoDB& evo
shareman{std::make_unique<llmq::CSigSharesManager>(connman, *llmq::quorumManager, *sigman, 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, peerman);
llmq::chainLocksHandler = std::make_unique<llmq::CChainLocksHandler>(chainstate, connman, *::masternodeSync, *llmq::quorumManager, *sigman, *shareman, sporkman, mempool, *peerman);
return llmq::chainLocksHandler.get();
}()},
isman{[&]() -> llmq::CInstantSendManager* const {
Expand Down

0 comments on commit e1a4cec

Please sign in to comment.