refactor: pass CNode by reference for ProcessMessage functions

This commit is contained in:
Kittywhiskers Van Gogh 2023-01-19 17:33:10 +00:00 committed by PastaPastaPasta
parent 97d485159b
commit a4e0327c29
15 changed files with 103 additions and 103 deletions

View File

@ -79,7 +79,7 @@ CChainLockSig CChainLocksHandler::GetBestChainLock() const
return bestChainLock; return bestChainLock;
} }
void CChainLocksHandler::ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRecv) void CChainLocksHandler::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv)
{ {
if (!AreChainLocksEnabled(spork_manager)) { if (!AreChainLocksEnabled(spork_manager)) {
return; return;
@ -89,7 +89,7 @@ void CChainLocksHandler::ProcessMessage(CNode* pfrom, const std::string& msg_typ
CChainLockSig clsig; CChainLockSig clsig;
vRecv >> clsig; vRecv >> clsig;
ProcessNewChainLock(pfrom->GetId(), clsig, ::SerializeHash(clsig)); ProcessNewChainLock(pfrom.GetId(), clsig, ::SerializeHash(clsig));
} }
} }

View File

@ -89,7 +89,7 @@ public:
bool GetChainLockByHash(const uint256& hash, CChainLockSig& ret) const; bool GetChainLockByHash(const uint256& hash, CChainLockSig& ret) const;
CChainLockSig GetBestChainLock() const; CChainLockSig GetBestChainLock() const;
void ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRecv); void ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv);
void ProcessNewChainLock(NodeId from, const CChainLockSig& clsig, const uint256& hash); void ProcessNewChainLock(NodeId from, const CChainLockSig& clsig, const uint256& hash);
void AcceptedBlockHeader(const CBlockIndex* pindexNew); void AcceptedBlockHeader(const CBlockIndex* pindexNew);
void UpdatedBlockTip(); void UpdatedBlockTip();

View File

@ -107,17 +107,17 @@ void CDKGSessionHandler::UpdatedBlockTip(const CBlockIndex* pindexNew)
params.name, quorumIndex, currentHeight, pQuorumBaseBlockIndex->nHeight, int(oldPhase), int(phase)); params.name, quorumIndex, currentHeight, pQuorumBaseBlockIndex->nHeight, int(oldPhase), int(phase));
} }
void CDKGSessionHandler::ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRecv) void CDKGSessionHandler::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv)
{ {
// We don't handle messages in the calling thread as deserialization/processing of these would block everything // We don't handle messages in the calling thread as deserialization/processing of these would block everything
if (msg_type == NetMsgType::QCONTRIB) { if (msg_type == NetMsgType::QCONTRIB) {
pendingContributions.PushPendingMessage(pfrom->GetId(), vRecv); pendingContributions.PushPendingMessage(pfrom.GetId(), vRecv);
} else if (msg_type == NetMsgType::QCOMPLAINT) { } else if (msg_type == NetMsgType::QCOMPLAINT) {
pendingComplaints.PushPendingMessage(pfrom->GetId(), vRecv); pendingComplaints.PushPendingMessage(pfrom.GetId(), vRecv);
} else if (msg_type == NetMsgType::QJUSTIFICATION) { } else if (msg_type == NetMsgType::QJUSTIFICATION) {
pendingJustifications.PushPendingMessage(pfrom->GetId(), vRecv); pendingJustifications.PushPendingMessage(pfrom.GetId(), vRecv);
} else if (msg_type == NetMsgType::QPCOMMITMENT) { } else if (msg_type == NetMsgType::QPCOMMITMENT) {
pendingPrematureCommitments.PushPendingMessage(pfrom->GetId(), vRecv); pendingPrematureCommitments.PushPendingMessage(pfrom.GetId(), vRecv);
} }
} }

View File

@ -153,7 +153,7 @@ public:
~CDKGSessionHandler() = default; ~CDKGSessionHandler() = default;
void UpdatedBlockTip(const CBlockIndex *pindexNew); void UpdatedBlockTip(const CBlockIndex *pindexNew);
void ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRecv); void ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv);
void StartThread(); void StartThread();
void StopThread(); void StopThread();

View File

@ -162,7 +162,7 @@ void CDKGSessionManager::UpdatedBlockTip(const CBlockIndex* pindexNew, bool fIni
} }
} }
void CDKGSessionManager::ProcessMessage(CNode* pfrom, const CQuorumManager& quorum_manager, const std::string& msg_type, CDataStream& vRecv) void CDKGSessionManager::ProcessMessage(CNode& pfrom, const CQuorumManager& quorum_manager, const std::string& msg_type, CDataStream& vRecv)
{ {
static Mutex cs_indexedQuorumsCache; static Mutex cs_indexedQuorumsCache;
static std::map<Consensus::LLMQType, unordered_lru_cache<uint256, int, StaticSaltedHasher>> indexedQuorumsCache GUARDED_BY(cs_indexedQuorumsCache); static std::map<Consensus::LLMQType, unordered_lru_cache<uint256, int, StaticSaltedHasher>> indexedQuorumsCache GUARDED_BY(cs_indexedQuorumsCache);
@ -179,13 +179,13 @@ void CDKGSessionManager::ProcessMessage(CNode* pfrom, const CQuorumManager& quor
} }
if (msg_type == NetMsgType::QWATCH) { if (msg_type == NetMsgType::QWATCH) {
pfrom->qwatch = true; pfrom.qwatch = true;
return; return;
} }
if (vRecv.empty()) { if (vRecv.empty()) {
LOCK(cs_main); LOCK(cs_main);
Misbehaving(pfrom->GetId(), 100); Misbehaving(pfrom.GetId(), 100);
return; return;
} }
@ -199,7 +199,7 @@ void CDKGSessionManager::ProcessMessage(CNode* pfrom, const CQuorumManager& quor
if (!Params().HasLLMQ(llmqType)) { if (!Params().HasLLMQ(llmqType)) {
LOCK(cs_main); LOCK(cs_main);
LogPrintf("CDKGSessionManager -- invalid llmqType [%d]\n", uint8_t(llmqType)); LogPrintf("CDKGSessionManager -- invalid llmqType [%d]\n", uint8_t(llmqType));
Misbehaving(pfrom->GetId(), 100); Misbehaving(pfrom.GetId(), 100);
return; return;
} }
@ -221,14 +221,14 @@ void CDKGSessionManager::ProcessMessage(CNode* pfrom, const CQuorumManager& quor
LOCK(cs_main); LOCK(cs_main);
LogPrintf("CDKGSessionManager -- unknown quorumHash %s\n", quorumHash.ToString()); LogPrintf("CDKGSessionManager -- unknown quorumHash %s\n", quorumHash.ToString());
// NOTE: do not insta-ban for this, we might be lagging behind // NOTE: do not insta-ban for this, we might be lagging behind
Misbehaving(pfrom->GetId(), 10); Misbehaving(pfrom.GetId(), 10);
return; return;
} }
if (!utils::IsQuorumTypeEnabled(llmqType, quorum_manager, pQuorumBaseBlockIndex->pprev)) { if (!utils::IsQuorumTypeEnabled(llmqType, quorum_manager, pQuorumBaseBlockIndex->pprev)) {
LOCK(cs_main); LOCK(cs_main);
LogPrintf("CDKGSessionManager -- llmqType [%d] quorums aren't active\n", uint8_t(llmqType)); LogPrintf("CDKGSessionManager -- llmqType [%d] quorums aren't active\n", uint8_t(llmqType));
Misbehaving(pfrom->GetId(), 100); Misbehaving(pfrom.GetId(), 100);
return; return;
} }
@ -240,14 +240,14 @@ void CDKGSessionManager::ProcessMessage(CNode* pfrom, const CQuorumManager& quor
if (quorumIndex > quorumIndexMax) { if (quorumIndex > quorumIndexMax) {
LOCK(cs_main); LOCK(cs_main);
LogPrintf("CDKGSessionManager -- invalid quorumHash %s\n", quorumHash.ToString()); LogPrintf("CDKGSessionManager -- invalid quorumHash %s\n", quorumHash.ToString());
Misbehaving(pfrom->GetId(), 100); Misbehaving(pfrom.GetId(), 100);
return; return;
} }
if (!dkgSessionHandlers.count(std::make_pair(llmqType, quorumIndex))) { if (!dkgSessionHandlers.count(std::make_pair(llmqType, quorumIndex))) {
LOCK(cs_main); LOCK(cs_main);
LogPrintf("CDKGSessionManager -- no session handlers for quorumIndex [%d]\n", quorumIndex); LogPrintf("CDKGSessionManager -- no session handlers for quorumIndex [%d]\n", quorumIndex);
Misbehaving(pfrom->GetId(), 100); Misbehaving(pfrom.GetId(), 100);
return; return;
} }
} }

View File

@ -62,7 +62,7 @@ public:
void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload); void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload);
void ProcessMessage(CNode* pfrom, const CQuorumManager& quorum_manager, const std::string& msg_type, CDataStream& vRecv); void ProcessMessage(CNode& pfrom, const CQuorumManager& quorum_manager, const std::string& msg_type, CDataStream& vRecv);
bool AlreadyHave(const CInv& inv) const; bool AlreadyHave(const CInv& inv) const;
bool GetContribution(const uint256& hash, CDKGContribution& ret) const; bool GetContribution(const uint256& hash, CDKGContribution& ret) const;
bool GetComplaint(const uint256& hash, CDKGComplaint& ret) const; bool GetComplaint(const uint256& hash, CDKGComplaint& ret) const;

View File

@ -762,7 +762,7 @@ void CInstantSendManager::HandleNewInstantSendLockRecoveredSig(const llmq::CReco
pendingInstantSendLocks.emplace(hash, std::make_pair(-1, islock)); pendingInstantSendLocks.emplace(hash, std::make_pair(-1, islock));
} }
void CInstantSendManager::ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRecv) void CInstantSendManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv)
{ {
if (!IsInstantSendEnabled()) { if (!IsInstantSendEnabled()) {
return; return;
@ -776,20 +776,20 @@ void CInstantSendManager::ProcessMessage(CNode* pfrom, const std::string& msg_ty
} }
} }
void CInstantSendManager::ProcessMessageInstantSendLock(const CNode* pfrom, const llmq::CInstantSendLockPtr& islock) void CInstantSendManager::ProcessMessageInstantSendLock(const CNode& pfrom, const llmq::CInstantSendLockPtr& islock)
{ {
auto hash = ::SerializeHash(*islock); auto hash = ::SerializeHash(*islock);
bool fDIP0024IsActive = false; bool fDIP0024IsActive = false;
{ {
LOCK(cs_main); LOCK(cs_main);
EraseObjectRequest(pfrom->GetId(), CInv(islock->IsDeterministic() ? MSG_ISDLOCK : MSG_ISLOCK, hash)); EraseObjectRequest(pfrom.GetId(), CInv(islock->IsDeterministic() ? MSG_ISDLOCK : MSG_ISLOCK, hash));
fDIP0024IsActive = utils::IsDIP0024Active(::ChainActive().Tip()); fDIP0024IsActive = utils::IsDIP0024Active(::ChainActive().Tip());
} }
if (!islock->TriviallyValid()) { if (!islock->TriviallyValid()) {
LOCK(cs_main); LOCK(cs_main);
Misbehaving(pfrom->GetId(), 100); Misbehaving(pfrom.GetId(), 100);
return; return;
} }
@ -798,14 +798,14 @@ void CInstantSendManager::ProcessMessageInstantSendLock(const CNode* pfrom, cons
const auto blockIndex = WITH_LOCK(cs_main, return LookupBlockIndex(islock->cycleHash)); const auto blockIndex = WITH_LOCK(cs_main, return LookupBlockIndex(islock->cycleHash));
if (blockIndex == nullptr) { if (blockIndex == nullptr) {
// Maybe we don't have the block yet or maybe some peer spams invalid values for cycleHash // Maybe we don't have the block yet or maybe some peer spams invalid values for cycleHash
WITH_LOCK(cs_main, Misbehaving(pfrom->GetId(), 1)); WITH_LOCK(cs_main, Misbehaving(pfrom.GetId(), 1));
return; return;
} }
// Deterministic islocks MUST use rotation based llmq // Deterministic islocks MUST use rotation based llmq
auto llmqType = Params().GetConsensus().llmqTypeDIP0024InstantSend; auto llmqType = Params().GetConsensus().llmqTypeDIP0024InstantSend;
if (blockIndex->nHeight % GetLLMQParams(llmqType).dkgInterval != 0) { if (blockIndex->nHeight % GetLLMQParams(llmqType).dkgInterval != 0) {
WITH_LOCK(cs_main, Misbehaving(pfrom->GetId(), 100)); WITH_LOCK(cs_main, Misbehaving(pfrom.GetId(), 100));
return; return;
} }
} }
@ -822,10 +822,10 @@ void CInstantSendManager::ProcessMessageInstantSendLock(const CNode* pfrom, cons
} }
LogPrint(BCLog::INSTANTSEND, "CInstantSendManager::%s -- txid=%s, islock=%s: received islock, peer=%d\n", __func__, LogPrint(BCLog::INSTANTSEND, "CInstantSendManager::%s -- txid=%s, islock=%s: received islock, peer=%d\n", __func__,
islock->txid.ToString(), hash.ToString(), pfrom->GetId()); islock->txid.ToString(), hash.ToString(), pfrom.GetId());
LOCK(cs_pendingLocks); LOCK(cs_pendingLocks);
pendingInstantSendLocks.emplace(hash, std::make_pair(pfrom->GetId(), islock)); pendingInstantSendLocks.emplace(hash, std::make_pair(pfrom.GetId(), islock));
} }
/** /**

View File

@ -283,7 +283,7 @@ private:
bool TrySignInputLocks(const CTransaction& tx, bool allowResigning, Consensus::LLMQType llmqType, const Consensus::Params& params) LOCKS_EXCLUDED(cs_inputReqests); bool TrySignInputLocks(const CTransaction& tx, bool allowResigning, Consensus::LLMQType llmqType, const Consensus::Params& params) LOCKS_EXCLUDED(cs_inputReqests);
void TrySignInstantSendLock(const CTransaction& tx) LOCKS_EXCLUDED(cs_creating); void TrySignInstantSendLock(const CTransaction& tx) LOCKS_EXCLUDED(cs_creating);
void ProcessMessageInstantSendLock(const CNode* pfrom, const CInstantSendLockPtr& islock); void ProcessMessageInstantSendLock(const CNode& pfrom, const CInstantSendLockPtr& islock);
bool ProcessPendingInstantSendLocks(); bool ProcessPendingInstantSendLocks();
bool ProcessPendingInstantSendLocks(bool deterministic) LOCKS_EXCLUDED(cs_pendingLocks); bool ProcessPendingInstantSendLocks(bool deterministic) LOCKS_EXCLUDED(cs_pendingLocks);
@ -316,7 +316,7 @@ public:
void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override LOCKS_EXCLUDED(cs_inputReqests, cs_creating); void HandleNewRecoveredSig(const CRecoveredSig& recoveredSig) override LOCKS_EXCLUDED(cs_inputReqests, cs_creating);
void ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRecv); void ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv);
void TransactionAddedToMempool(const CTransactionRef& tx) LOCKS_EXCLUDED(cs_pendingLocks); void TransactionAddedToMempool(const CTransactionRef& tx) LOCKS_EXCLUDED(cs_pendingLocks);
void TransactionRemovedFromMempool(const CTransactionRef& tx); void TransactionRemovedFromMempool(const CTransactionRef& tx);

View File

@ -437,18 +437,18 @@ bool CQuorumManager::HasQuorum(Consensus::LLMQType llmqType, const CQuorumBlockP
return quorum_block_processor.HasMinedCommitment(llmqType, quorumHash); return quorum_block_processor.HasMinedCommitment(llmqType, quorumHash);
} }
bool CQuorumManager::RequestQuorumData(CNode* pFrom, Consensus::LLMQType llmqType, const CBlockIndex* pQuorumBaseBlockIndex, uint16_t nDataMask, const uint256& proTxHash) const bool CQuorumManager::RequestQuorumData(CNode* pfrom, Consensus::LLMQType llmqType, const CBlockIndex* pQuorumBaseBlockIndex, uint16_t nDataMask, const uint256& proTxHash) const
{ {
if (pFrom == nullptr) { if (pfrom == nullptr) {
LogPrint(BCLog::LLMQ, "CQuorumManager::%s -- Invalid pFrom: nullptr\n", __func__); LogPrint(BCLog::LLMQ, "CQuorumManager::%s -- Invalid pfrom: nullptr\n", __func__);
return false; return false;
} }
if (pFrom->nVersion < LLMQ_DATA_MESSAGES_VERSION) { if (pfrom->nVersion < LLMQ_DATA_MESSAGES_VERSION) {
LogPrint(BCLog::LLMQ, "CQuorumManager::%s -- Version must be %d or greater.\n", __func__, LLMQ_DATA_MESSAGES_VERSION); LogPrint(BCLog::LLMQ, "CQuorumManager::%s -- Version must be %d or greater.\n", __func__, LLMQ_DATA_MESSAGES_VERSION);
return false; return false;
} }
if (pFrom->GetVerifiedProRegTxHash().IsNull() && !pFrom->qwatch) { if (pfrom->GetVerifiedProRegTxHash().IsNull() && !pfrom->qwatch) {
LogPrint(BCLog::LLMQ, "CQuorumManager::%s -- pFrom is neither a verified masternode nor a qwatch connection\n", __func__); LogPrint(BCLog::LLMQ, "CQuorumManager::%s -- pfrom is neither a verified masternode nor a qwatch connection\n", __func__);
return false; return false;
} }
if (!Params().HasLLMQ(llmqType)) { if (!Params().HasLLMQ(llmqType)) {
@ -466,7 +466,7 @@ bool CQuorumManager::RequestQuorumData(CNode* pFrom, Consensus::LLMQType llmqTyp
LOCK(cs_data_requests); LOCK(cs_data_requests);
CQuorumDataRequestKey key; CQuorumDataRequestKey key;
key.proRegTx = pFrom->GetVerifiedProRegTxHash(); key.proRegTx = pfrom->GetVerifiedProRegTxHash();
key.flag = true; key.flag = true;
key.quorumHash = pQuorumBaseBlockIndex->GetBlockHash(); key.quorumHash = pQuorumBaseBlockIndex->GetBlockHash();
key.llmqType = llmqType; key.llmqType = llmqType;
@ -476,8 +476,8 @@ bool CQuorumManager::RequestQuorumData(CNode* pFrom, Consensus::LLMQType llmqTyp
return false; return false;
} }
CNetMsgMaker msgMaker(pFrom->GetSendVersion()); CNetMsgMaker msgMaker(pfrom->GetSendVersion());
connman.PushMessage(pFrom, msgMaker.Make(NetMsgType::QGETDATA, it.first->second)); connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::QGETDATA, it.first->second));
return true; return true;
} }
@ -604,20 +604,20 @@ size_t CQuorumManager::GetQuorumRecoveryStartOffset(const CQuorumCPtr pQuorum, c
return nIndex % pQuorum->qc->validMembers.size(); return nIndex % pQuorum->qc->validMembers.size();
} }
void CQuorumManager::ProcessMessage(CNode* pFrom, const std::string& msg_type, CDataStream& vRecv) void CQuorumManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv)
{ {
auto strFunc = __func__; auto strFunc = __func__;
auto errorHandler = [&](const std::string& strError, int nScore = 10) { auto errorHandler = [&](const std::string& strError, int nScore = 10) {
LogPrint(BCLog::LLMQ, "CQuorumManager::%s -- %s: %s, from peer=%d\n", strFunc, msg_type, strError, pFrom->GetId()); LogPrint(BCLog::LLMQ, "CQuorumManager::%s -- %s: %s, from peer=%d\n", strFunc, msg_type, strError, pfrom.GetId());
if (nScore > 0) { if (nScore > 0) {
LOCK(cs_main); LOCK(cs_main);
Misbehaving(pFrom->GetId(), nScore); Misbehaving(pfrom.GetId(), nScore);
} }
}; };
if (msg_type == NetMsgType::QGETDATA) { if (msg_type == NetMsgType::QGETDATA) {
if (!fMasternodeMode || pFrom == nullptr || (pFrom->GetVerifiedProRegTxHash().IsNull() && !pFrom->qwatch)) { if (!fMasternodeMode || (pfrom.GetVerifiedProRegTxHash().IsNull() && !pfrom.qwatch)) {
errorHandler("Not a verified masternode or a qwatch connection"); errorHandler("Not a verified masternode or a qwatch connection");
return; return;
} }
@ -628,14 +628,14 @@ void CQuorumManager::ProcessMessage(CNode* pFrom, const std::string& msg_type, C
auto sendQDATA = [&](CQuorumDataRequest::Errors nError = CQuorumDataRequest::Errors::UNDEFINED, auto sendQDATA = [&](CQuorumDataRequest::Errors nError = CQuorumDataRequest::Errors::UNDEFINED,
const CDataStream& body = CDataStream(SER_NETWORK, PROTOCOL_VERSION)) { const CDataStream& body = CDataStream(SER_NETWORK, PROTOCOL_VERSION)) {
request.SetError(nError); request.SetError(nError);
CDataStream ssResponse(SER_NETWORK, pFrom->GetSendVersion(), request, body); CDataStream ssResponse(SER_NETWORK, pfrom.GetSendVersion(), request, body);
connman.PushMessage(pFrom, CNetMsgMaker(pFrom->GetSendVersion()).Make(NetMsgType::QDATA, ssResponse)); connman.PushMessage(&pfrom, CNetMsgMaker(pfrom.GetSendVersion()).Make(NetMsgType::QDATA, ssResponse));
}; };
{ {
LOCK2(cs_main, cs_data_requests); LOCK2(cs_main, cs_data_requests);
CQuorumDataRequestKey key; CQuorumDataRequestKey key;
key.proRegTx = pFrom->GetVerifiedProRegTxHash(); key.proRegTx = pfrom.GetVerifiedProRegTxHash();
key.flag = false; key.flag = false;
key.quorumHash = request.GetQuorumHash(); key.quorumHash = request.GetQuorumHash();
key.llmqType = request.GetLLMQType(); key.llmqType = request.GetLLMQType();
@ -666,7 +666,7 @@ void CQuorumManager::ProcessMessage(CNode* pFrom, const std::string& msg_type, C
return; return;
} }
CDataStream ssResponseData(SER_NETWORK, pFrom->GetSendVersion()); CDataStream ssResponseData(SER_NETWORK, pfrom.GetSendVersion());
// Check if request wants QUORUM_VERIFICATION_VECTOR data // Check if request wants QUORUM_VERIFICATION_VECTOR data
if (request.GetDataMask() & CQuorumDataRequest::QUORUM_VERIFICATION_VECTOR) { if (request.GetDataMask() & CQuorumDataRequest::QUORUM_VERIFICATION_VECTOR) {
@ -701,7 +701,7 @@ void CQuorumManager::ProcessMessage(CNode* pFrom, const std::string& msg_type, C
} }
if (msg_type == NetMsgType::QDATA) { if (msg_type == NetMsgType::QDATA) {
if ((!fMasternodeMode && !utils::IsWatchQuorumsEnabled()) || pFrom == nullptr || (pFrom->GetVerifiedProRegTxHash().IsNull() && !pFrom->qwatch)) { if ((!fMasternodeMode && !utils::IsWatchQuorumsEnabled()) || (pfrom.GetVerifiedProRegTxHash().IsNull() && !pfrom.qwatch)) {
errorHandler("Not a verified masternode or a qwatch connection"); errorHandler("Not a verified masternode or a qwatch connection");
return; return;
} }
@ -712,7 +712,7 @@ void CQuorumManager::ProcessMessage(CNode* pFrom, const std::string& msg_type, C
{ {
LOCK2(cs_main, cs_data_requests); LOCK2(cs_main, cs_data_requests);
CQuorumDataRequestKey key; CQuorumDataRequestKey key;
key.proRegTx = pFrom->GetVerifiedProRegTxHash(); key.proRegTx = pfrom.GetVerifiedProRegTxHash();
key.flag = true; key.flag = true;
key.quorumHash = request.GetQuorumHash(); key.quorumHash = request.GetQuorumHash();
key.llmqType = request.GetLLMQType(); key.llmqType = request.GetLLMQType();

View File

@ -232,11 +232,11 @@ public:
void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload) const; void UpdatedBlockTip(const CBlockIndex *pindexNew, bool fInitialDownload) const;
void ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRecv); void ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv);
static bool HasQuorum(Consensus::LLMQType llmqType, const CQuorumBlockProcessor& quorum_block_processor, const uint256& quorumHash); static bool HasQuorum(Consensus::LLMQType llmqType, const CQuorumBlockProcessor& quorum_block_processor, const uint256& quorumHash);
bool RequestQuorumData(CNode* pFrom, Consensus::LLMQType llmqType, const CBlockIndex* pQuorumBaseBlockIndex, uint16_t nDataMask, const uint256& proTxHash = uint256()) const; bool RequestQuorumData(CNode* pfrom, Consensus::LLMQType llmqType, const CBlockIndex* pQuorumBaseBlockIndex, uint16_t nDataMask, const uint256& proTxHash = uint256()) const;
// all these methods will lock cs_main for a short period of time // all these methods will lock cs_main for a short period of time
CQuorumCPtr GetQuorum(Consensus::LLMQType llmqType, const uint256& quorumHash) const; CQuorumCPtr GetQuorum(Consensus::LLMQType llmqType, const uint256& quorumHash) const;

View File

@ -557,7 +557,7 @@ bool CSigningManager::GetRecoveredSigForGetData(const uint256& hash, CRecoveredS
return true; return true;
} }
void CSigningManager::ProcessMessage(CNode* pfrom, const std::string& msg_type, CDataStream& vRecv) void CSigningManager::ProcessMessage(CNode& pfrom, const std::string& msg_type, CDataStream& vRecv)
{ {
if (msg_type == NetMsgType::QSIGREC) { if (msg_type == NetMsgType::QSIGREC) {
auto recoveredSig = std::make_shared<CRecoveredSig>(); auto recoveredSig = std::make_shared<CRecoveredSig>();
@ -566,18 +566,18 @@ void CSigningManager::ProcessMessage(CNode* pfrom, const std::string& msg_type,
} }
} }
void CSigningManager::ProcessMessageRecoveredSig(CNode* pfrom, const std::shared_ptr<const CRecoveredSig>& recoveredSig) void CSigningManager::ProcessMessageRecoveredSig(CNode& pfrom, const std::shared_ptr<const CRecoveredSig>& recoveredSig)
{ {
{ {
LOCK(cs_main); LOCK(cs_main);
EraseObjectRequest(pfrom->GetId(), CInv(MSG_QUORUM_RECOVERED_SIG, recoveredSig->GetHash())); EraseObjectRequest(pfrom.GetId(), CInv(MSG_QUORUM_RECOVERED_SIG, recoveredSig->GetHash()));
} }
bool ban = false; bool ban = false;
if (!PreVerifyRecoveredSig(qman, *recoveredSig, ban)) { if (!PreVerifyRecoveredSig(qman, *recoveredSig, ban)) {
if (ban) { if (ban) {
LOCK(cs_main); LOCK(cs_main);
Misbehaving(pfrom->GetId(), 100); Misbehaving(pfrom.GetId(), 100);
} }
return; return;
} }
@ -589,16 +589,16 @@ void CSigningManager::ProcessMessageRecoveredSig(CNode* pfrom, const std::shared
} }
LogPrint(BCLog::LLMQ, "CSigningManager::%s -- signHash=%s, id=%s, msgHash=%s, node=%d\n", __func__, LogPrint(BCLog::LLMQ, "CSigningManager::%s -- signHash=%s, id=%s, msgHash=%s, node=%d\n", __func__,
recoveredSig->buildSignHash().ToString(), recoveredSig->getId().ToString(), recoveredSig->getMsgHash().ToString(), pfrom->GetId()); recoveredSig->buildSignHash().ToString(), recoveredSig->getId().ToString(), recoveredSig->getMsgHash().ToString(), pfrom.GetId());
LOCK(cs); LOCK(cs);
if (pendingReconstructedRecoveredSigs.count(recoveredSig->GetHash())) { if (pendingReconstructedRecoveredSigs.count(recoveredSig->GetHash())) {
// no need to perform full verification // no need to perform full verification
LogPrint(BCLog::LLMQ, "CSigningManager::%s -- already pending reconstructed sig, signHash=%s, id=%s, msgHash=%s, node=%d\n", __func__, LogPrint(BCLog::LLMQ, "CSigningManager::%s -- already pending reconstructed sig, signHash=%s, id=%s, msgHash=%s, node=%d\n", __func__,
recoveredSig->buildSignHash().ToString(), recoveredSig->getId().ToString(), recoveredSig->getMsgHash().ToString(), pfrom->GetId()); recoveredSig->buildSignHash().ToString(), recoveredSig->getId().ToString(), recoveredSig->getMsgHash().ToString(), pfrom.GetId());
return; return;
} }
pendingRecoveredSigs[pfrom->GetId()].emplace_back(recoveredSig); pendingRecoveredSigs[pfrom.GetId()].emplace_back(recoveredSig);
} }
bool CSigningManager::PreVerifyRecoveredSig(const CQuorumManager& quorum_manager, const CRecoveredSig& recoveredSig, bool& retBan) bool CSigningManager::PreVerifyRecoveredSig(const CQuorumManager& quorum_manager, const CRecoveredSig& recoveredSig, bool& retBan)

View File

@ -184,7 +184,7 @@ public:
bool AlreadyHave(const CInv& inv) const; bool AlreadyHave(const CInv& inv) const;
bool GetRecoveredSigForGetData(const uint256& hash, CRecoveredSig& ret) const; bool GetRecoveredSigForGetData(const uint256& hash, CRecoveredSig& ret) const;
void ProcessMessage(CNode* pnode, const std::string& msg_type, CDataStream& vRecv); void ProcessMessage(CNode& pnode, const std::string& msg_type, CDataStream& vRecv);
// This is called when a recovered signature was was reconstructed from another P2P message and is known to be valid // This is called when a recovered signature was was reconstructed from another P2P message and is known to be valid
// This is the case for example when a signature appears as part of InstantSend or ChainLocks // This is the case for example when a signature appears as part of InstantSend or ChainLocks
@ -197,7 +197,7 @@ public:
void TruncateRecoveredSig(Consensus::LLMQType llmqType, const uint256& id); void TruncateRecoveredSig(Consensus::LLMQType llmqType, const uint256& id);
private: private:
void ProcessMessageRecoveredSig(CNode* pfrom, const std::shared_ptr<const CRecoveredSig>& recoveredSig); void ProcessMessageRecoveredSig(CNode& pfrom, const std::shared_ptr<const CRecoveredSig>& recoveredSig);
static bool PreVerifyRecoveredSig(const CQuorumManager& quorum_manager, const CRecoveredSig& recoveredSig, bool& retBan); static bool PreVerifyRecoveredSig(const CQuorumManager& quorum_manager, const CRecoveredSig& recoveredSig, bool& retBan);
void CollectPendingRecoveredSigsToVerify(size_t maxUniqueSessions, void CollectPendingRecoveredSigsToVerify(size_t maxUniqueSessions,

View File

@ -212,7 +212,7 @@ void CSigSharesManager::InterruptWorkerThread()
workInterrupt(); workInterrupt();
} }
void CSigSharesManager::ProcessMessage(const CNode* pfrom, const std::string& msg_type, CDataStream& vRecv, const CSporkManager& sporkManager) void CSigSharesManager::ProcessMessage(const CNode& pfrom, const std::string& msg_type, CDataStream& vRecv, const CSporkManager& sporkManager)
{ {
// non-masternodes are not interested in sigshares // non-masternodes are not interested in sigshares
if (!fMasternodeMode || WITH_LOCK(activeMasternodeInfoCs, return activeMasternodeInfo.proTxHash.IsNull())) { if (!fMasternodeMode || WITH_LOCK(activeMasternodeInfoCs, return activeMasternodeInfo.proTxHash.IsNull())) {
@ -224,13 +224,13 @@ void CSigSharesManager::ProcessMessage(const CNode* pfrom, const std::string& ms
vRecv >> receivedSigShares; vRecv >> receivedSigShares;
if (receivedSigShares.size() > MAX_MSGS_SIG_SHARES) { if (receivedSigShares.size() > MAX_MSGS_SIG_SHARES) {
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- too many sigs in QSIGSHARE message. cnt=%d, max=%d, node=%d\n", __func__, receivedSigShares.size(), MAX_MSGS_SIG_SHARES, pfrom->GetId()); LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- too many sigs in QSIGSHARE message. cnt=%d, max=%d, node=%d\n", __func__, receivedSigShares.size(), MAX_MSGS_SIG_SHARES, pfrom.GetId());
BanNode(pfrom->GetId()); BanNode(pfrom.GetId());
return; return;
} }
for (const auto& sigShare : receivedSigShares) { for (const auto& sigShare : receivedSigShares) {
ProcessMessageSigShare(pfrom->GetId(), sigShare); ProcessMessageSigShare(pfrom.GetId(), sigShare);
} }
} }
@ -238,39 +238,39 @@ void CSigSharesManager::ProcessMessage(const CNode* pfrom, const std::string& ms
std::vector<CSigSesAnn> msgs; std::vector<CSigSesAnn> msgs;
vRecv >> msgs; vRecv >> msgs;
if (msgs.size() > MAX_MSGS_CNT_QSIGSESANN) { if (msgs.size() > MAX_MSGS_CNT_QSIGSESANN) {
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- too many announcements in QSIGSESANN message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_CNT_QSIGSESANN, pfrom->GetId()); LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- too many announcements in QSIGSESANN message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_CNT_QSIGSESANN, pfrom.GetId());
BanNode(pfrom->GetId()); BanNode(pfrom.GetId());
return; return;
} }
if (!ranges::all_of(msgs, if (!ranges::all_of(msgs,
[this, &pfrom](const auto& ann){ return ProcessMessageSigSesAnn(pfrom, ann); })) { [this, &pfrom](const auto& ann){ return ProcessMessageSigSesAnn(pfrom, ann); })) {
BanNode(pfrom->GetId()); BanNode(pfrom.GetId());
return; return;
} }
} else if (msg_type == NetMsgType::QSIGSHARESINV) { } else if (msg_type == NetMsgType::QSIGSHARESINV) {
std::vector<CSigSharesInv> msgs; std::vector<CSigSharesInv> msgs;
vRecv >> msgs; vRecv >> msgs;
if (msgs.size() > MAX_MSGS_CNT_QSIGSHARESINV) { if (msgs.size() > MAX_MSGS_CNT_QSIGSHARESINV) {
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- too many invs in QSIGSHARESINV message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_CNT_QSIGSHARESINV, pfrom->GetId()); LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- too many invs in QSIGSHARESINV message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_CNT_QSIGSHARESINV, pfrom.GetId());
BanNode(pfrom->GetId()); BanNode(pfrom.GetId());
return; return;
} }
if (!ranges::all_of(msgs, if (!ranges::all_of(msgs,
[this, &pfrom](const auto& inv){ return ProcessMessageSigSharesInv(pfrom, inv); })) { [this, &pfrom](const auto& inv){ return ProcessMessageSigSharesInv(pfrom, inv); })) {
BanNode(pfrom->GetId()); BanNode(pfrom.GetId());
return; return;
} }
} else if (msg_type == NetMsgType::QGETSIGSHARES) { } else if (msg_type == NetMsgType::QGETSIGSHARES) {
std::vector<CSigSharesInv> msgs; std::vector<CSigSharesInv> msgs;
vRecv >> msgs; vRecv >> msgs;
if (msgs.size() > MAX_MSGS_CNT_QGETSIGSHARES) { if (msgs.size() > MAX_MSGS_CNT_QGETSIGSHARES) {
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- too many invs in QGETSIGSHARES message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_CNT_QGETSIGSHARES, pfrom->GetId()); LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- too many invs in QGETSIGSHARES message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_CNT_QGETSIGSHARES, pfrom.GetId());
BanNode(pfrom->GetId()); BanNode(pfrom.GetId());
return; return;
} }
if (!ranges::all_of(msgs, if (!ranges::all_of(msgs,
[this, &pfrom](const auto& inv){ return ProcessMessageGetSigShares(pfrom, inv); })) { [this, &pfrom](const auto& inv){ return ProcessMessageGetSigShares(pfrom, inv); })) {
BanNode(pfrom->GetId()); BanNode(pfrom.GetId());
return; return;
} }
} else if (msg_type == NetMsgType::QBSIGSHARES) { } else if (msg_type == NetMsgType::QBSIGSHARES) {
@ -281,19 +281,19 @@ void CSigSharesManager::ProcessMessage(const CNode* pfrom, const std::string& ms
totalSigsCount += bs.sigShares.size(); totalSigsCount += bs.sigShares.size();
} }
if (totalSigsCount > MAX_MSGS_TOTAL_BATCHED_SIGS) { if (totalSigsCount > MAX_MSGS_TOTAL_BATCHED_SIGS) {
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- too many sigs in QBSIGSHARES message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_TOTAL_BATCHED_SIGS, pfrom->GetId()); LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- too many sigs in QBSIGSHARES message. cnt=%d, max=%d, node=%d\n", __func__, msgs.size(), MAX_MSGS_TOTAL_BATCHED_SIGS, pfrom.GetId());
BanNode(pfrom->GetId()); BanNode(pfrom.GetId());
return; return;
} }
if (!ranges::all_of(msgs, if (!ranges::all_of(msgs,
[this, &pfrom](const auto& bs){ return ProcessMessageBatchedSigShares(pfrom, bs); })) { [this, &pfrom](const auto& bs){ return ProcessMessageBatchedSigShares(pfrom, bs); })) {
BanNode(pfrom->GetId()); BanNode(pfrom.GetId());
return; return;
} }
} }
} }
bool CSigSharesManager::ProcessMessageSigSesAnn(const CNode* pfrom, const CSigSesAnn& ann) bool CSigSharesManager::ProcessMessageSigSesAnn(const CNode& pfrom, const CSigSesAnn& ann)
{ {
auto llmqType = ann.getLlmqType(); auto llmqType = ann.getLlmqType();
if (!Params().HasLLMQ(llmqType)) { if (!Params().HasLLMQ(llmqType)) {
@ -303,18 +303,18 @@ bool CSigSharesManager::ProcessMessageSigSesAnn(const CNode* pfrom, const CSigSe
return false; return false;
} }
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- ann={%s}, node=%d\n", __func__, ann.ToString(), pfrom->GetId()); LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- ann={%s}, node=%d\n", __func__, ann.ToString(), pfrom.GetId());
auto quorum = qman.GetQuorum(llmqType, ann.getQuorumHash()); auto quorum = qman.GetQuorum(llmqType, ann.getQuorumHash());
if (!quorum) { if (!quorum) {
// TODO should we ban here? // TODO should we ban here?
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- quorum %s not found, node=%d\n", __func__, LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- quorum %s not found, node=%d\n", __func__,
ann.getQuorumHash().ToString(), pfrom->GetId()); ann.getQuorumHash().ToString(), pfrom.GetId());
return true; // let's still try other announcements from the same message return true; // let's still try other announcements from the same message
} }
LOCK(cs); LOCK(cs);
auto& nodeState = nodeStates[pfrom->GetId()]; auto& nodeState = nodeStates[pfrom.GetId()];
auto& session = nodeState.GetOrCreateSessionFromAnn(ann); auto& session = nodeState.GetOrCreateSessionFromAnn(ann);
nodeState.sessionByRecvId.erase(session.recvSessionId); nodeState.sessionByRecvId.erase(session.recvSessionId);
nodeState.sessionByRecvId.erase(ann.getSessionId()); nodeState.sessionByRecvId.erase(ann.getSessionId());
@ -330,10 +330,10 @@ bool CSigSharesManager::VerifySigSharesInv(Consensus::LLMQType llmqType, const C
return inv.inv.size() == size_t(GetLLMQParams(llmqType).size); return inv.inv.size() == size_t(GetLLMQParams(llmqType).size);
} }
bool CSigSharesManager::ProcessMessageSigSharesInv(const CNode* pfrom, const CSigSharesInv& inv) bool CSigSharesManager::ProcessMessageSigSharesInv(const CNode& pfrom, const CSigSharesInv& inv)
{ {
CSigSharesNodeState::SessionInfo sessionInfo; CSigSharesNodeState::SessionInfo sessionInfo;
if (!GetSessionInfoByRecvId(pfrom->GetId(), inv.sessionId, sessionInfo)) { if (!GetSessionInfoByRecvId(pfrom.GetId(), inv.sessionId, sessionInfo)) {
return true; return true;
} }
@ -347,17 +347,17 @@ bool CSigSharesManager::ProcessMessageSigSharesInv(const CNode* pfrom, const CSi
} }
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- signHash=%s, inv={%s}, node=%d\n", __func__, LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- signHash=%s, inv={%s}, node=%d\n", __func__,
sessionInfo.signHash.ToString(), inv.ToString(), pfrom->GetId()); sessionInfo.signHash.ToString(), inv.ToString(), pfrom.GetId());
if (!sessionInfo.quorum->HasVerificationVector()) { if (!sessionInfo.quorum->HasVerificationVector()) {
// TODO we should allow to ask other nodes for the quorum vvec if we missed it in the DKG // TODO we should allow to ask other nodes for the quorum vvec if we missed it in the DKG
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- we don't have the quorum vvec for %s, not requesting sig shares. node=%d\n", __func__, LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- we don't have the quorum vvec for %s, not requesting sig shares. node=%d\n", __func__,
sessionInfo.quorumHash.ToString(), pfrom->GetId()); sessionInfo.quorumHash.ToString(), pfrom.GetId());
return true; return true;
} }
LOCK(cs); LOCK(cs);
auto& nodeState = nodeStates[pfrom->GetId()]; auto& nodeState = nodeStates[pfrom.GetId()];
auto* session = nodeState.GetSessionByRecvId(inv.sessionId); auto* session = nodeState.GetSessionByRecvId(inv.sessionId);
if (session == nullptr) { if (session == nullptr) {
return true; return true;
@ -367,10 +367,10 @@ bool CSigSharesManager::ProcessMessageSigSharesInv(const CNode* pfrom, const CSi
return true; return true;
} }
bool CSigSharesManager::ProcessMessageGetSigShares(const CNode* pfrom, const CSigSharesInv& inv) bool CSigSharesManager::ProcessMessageGetSigShares(const CNode& pfrom, const CSigSharesInv& inv)
{ {
CSigSharesNodeState::SessionInfo sessionInfo; CSigSharesNodeState::SessionInfo sessionInfo;
if (!GetSessionInfoByRecvId(pfrom->GetId(), inv.sessionId, sessionInfo)) { if (!GetSessionInfoByRecvId(pfrom.GetId(), inv.sessionId, sessionInfo)) {
return true; return true;
} }
@ -384,10 +384,10 @@ bool CSigSharesManager::ProcessMessageGetSigShares(const CNode* pfrom, const CSi
} }
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- signHash=%s, inv={%s}, node=%d\n", __func__, LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- signHash=%s, inv={%s}, node=%d\n", __func__,
sessionInfo.signHash.ToString(), inv.ToString(), pfrom->GetId()); sessionInfo.signHash.ToString(), inv.ToString(), pfrom.GetId());
LOCK(cs); LOCK(cs);
auto& nodeState = nodeStates[pfrom->GetId()]; auto& nodeState = nodeStates[pfrom.GetId()];
auto* session = nodeState.GetSessionByRecvId(inv.sessionId); auto* session = nodeState.GetSessionByRecvId(inv.sessionId);
if (session == nullptr) { if (session == nullptr) {
return true; return true;
@ -397,10 +397,10 @@ bool CSigSharesManager::ProcessMessageGetSigShares(const CNode* pfrom, const CSi
return true; return true;
} }
bool CSigSharesManager::ProcessMessageBatchedSigShares(const CNode* pfrom, const CBatchedSigShares& batchedSigShares) bool CSigSharesManager::ProcessMessageBatchedSigShares(const CNode& pfrom, const CBatchedSigShares& batchedSigShares)
{ {
CSigSharesNodeState::SessionInfo sessionInfo; CSigSharesNodeState::SessionInfo sessionInfo;
if (!GetSessionInfoByRecvId(pfrom->GetId(), batchedSigShares.sessionId, sessionInfo)) { if (!GetSessionInfoByRecvId(pfrom.GetId(), batchedSigShares.sessionId, sessionInfo)) {
return true; return true;
} }
@ -413,7 +413,7 @@ bool CSigSharesManager::ProcessMessageBatchedSigShares(const CNode* pfrom, const
{ {
LOCK(cs); LOCK(cs);
auto& nodeState = nodeStates[pfrom->GetId()]; auto& nodeState = nodeStates[pfrom.GetId()];
for (const auto& sigSharetmp : batchedSigShares.sigShares) { for (const auto& sigSharetmp : batchedSigShares.sigShares) {
CSigShare sigShare = RebuildSigShare(sessionInfo, sigSharetmp); CSigShare sigShare = RebuildSigShare(sessionInfo, sigSharetmp);
@ -437,14 +437,14 @@ bool CSigSharesManager::ProcessMessageBatchedSigShares(const CNode* pfrom, const
} }
LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- signHash=%s, shares=%d, new=%d, inv={%s}, node=%d\n", __func__, LogPrint(BCLog::LLMQ_SIGS, "CSigSharesManager::%s -- signHash=%s, shares=%d, new=%d, inv={%s}, node=%d\n", __func__,
sessionInfo.signHash.ToString(), batchedSigShares.sigShares.size(), sigSharesToProcess.size(), batchedSigShares.ToInvString(), pfrom->GetId()); sessionInfo.signHash.ToString(), batchedSigShares.sigShares.size(), sigSharesToProcess.size(), batchedSigShares.ToInvString(), pfrom.GetId());
if (sigSharesToProcess.empty()) { if (sigSharesToProcess.empty()) {
return true; return true;
} }
LOCK(cs); LOCK(cs);
auto& nodeState = nodeStates[pfrom->GetId()]; auto& nodeState = nodeStates[pfrom.GetId()];
for (const auto& s : sigSharesToProcess) { for (const auto& s : sigSharesToProcess) {
nodeState.pendingIncomingSigShares.Add(s.GetKey(), s); nodeState.pendingIncomingSigShares.Add(s.GetKey(), s);
} }

View File

@ -416,7 +416,7 @@ public:
void UnregisterAsRecoveredSigsListener(); void UnregisterAsRecoveredSigsListener();
void InterruptWorkerThread(); void InterruptWorkerThread();
void ProcessMessage(const CNode* pnode, const std::string& msg_type, CDataStream& vRecv, const CSporkManager& sporkManager); void ProcessMessage(const CNode& pnode, const std::string& msg_type, CDataStream& vRecv, const CSporkManager& sporkManager);
void AsyncSign(const CQuorumCPtr& quorum, const uint256& id, const uint256& msgHash); void AsyncSign(const CQuorumCPtr& quorum, const uint256& id, const uint256& msgHash);
std::optional<CSigShare> CreateSigShare(const CQuorumCPtr& quorum, const uint256& id, const uint256& msgHash) const; std::optional<CSigShare> CreateSigShare(const CQuorumCPtr& quorum, const uint256& id, const uint256& msgHash) const;
@ -428,10 +428,10 @@ public:
private: private:
// all of these return false when the currently processed message should be aborted (as each message actually contains multiple messages) // all of these return false when the currently processed message should be aborted (as each message actually contains multiple messages)
bool ProcessMessageSigSesAnn(const CNode* pfrom, const CSigSesAnn& ann); bool ProcessMessageSigSesAnn(const CNode& pfrom, const CSigSesAnn& ann);
bool ProcessMessageSigSharesInv(const CNode* pfrom, const CSigSharesInv& inv); bool ProcessMessageSigSharesInv(const CNode& pfrom, const CSigSharesInv& inv);
bool ProcessMessageGetSigShares(const CNode* pfrom, const CSigSharesInv& inv); bool ProcessMessageGetSigShares(const CNode& pfrom, const CSigSharesInv& inv);
bool ProcessMessageBatchedSigShares(const CNode* pfrom, const CBatchedSigShares& batchedSigShares); bool ProcessMessageBatchedSigShares(const CNode& pfrom, const CBatchedSigShares& batchedSigShares);
void ProcessMessageSigShare(NodeId fromId, const CSigShare& sigShare); void ProcessMessageSigShare(NodeId fromId, const CSigShare& sigShare);
static bool VerifySigSharesInv(Consensus::LLMQType llmqType, const CSigSharesInv& inv); static bool VerifySigSharesInv(Consensus::LLMQType llmqType, const CSigSharesInv& inv);

View File

@ -4122,12 +4122,12 @@ void PeerLogicValidation::ProcessMessage(
governance->ProcessMessage(pfrom, msg_type, vRecv, m_connman); governance->ProcessMessage(pfrom, msg_type, vRecv, m_connman);
CMNAuth::ProcessMessage(pfrom, msg_type, vRecv, m_connman); CMNAuth::ProcessMessage(pfrom, msg_type, vRecv, m_connman);
m_llmq_ctx->quorum_block_processor->ProcessMessage(pfrom, msg_type, vRecv); m_llmq_ctx->quorum_block_processor->ProcessMessage(pfrom, msg_type, vRecv);
m_llmq_ctx->qdkgsman->ProcessMessage(&pfrom, *m_llmq_ctx->qman, msg_type, vRecv); m_llmq_ctx->qdkgsman->ProcessMessage(pfrom, *m_llmq_ctx->qman, msg_type, vRecv);
m_llmq_ctx->qman->ProcessMessage(&pfrom, msg_type, vRecv); m_llmq_ctx->qman->ProcessMessage(pfrom, msg_type, vRecv);
m_llmq_ctx->shareman->ProcessMessage(&pfrom, msg_type, vRecv, *sporkManager); m_llmq_ctx->shareman->ProcessMessage(pfrom, msg_type, vRecv, *sporkManager);
m_llmq_ctx->sigman->ProcessMessage(&pfrom, msg_type, vRecv); m_llmq_ctx->sigman->ProcessMessage(pfrom, msg_type, vRecv);
m_llmq_ctx->clhandler->ProcessMessage(&pfrom, msg_type, vRecv); m_llmq_ctx->clhandler->ProcessMessage(pfrom, msg_type, vRecv);
m_llmq_ctx->isman->ProcessMessage(&pfrom, msg_type, vRecv); m_llmq_ctx->isman->ProcessMessage(pfrom, msg_type, vRecv);
return; return;
} }