diff --git a/src/governance/governance.cpp b/src/governance/governance.cpp index d0fc86c8d9..5edee2bcf8 100644 --- a/src/governance/governance.cpp +++ b/src/governance/governance.cpp @@ -135,7 +135,7 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, const std::string& strComm { LOCK(cs_main); - connman.RemoveAskFor(nHash); + EraseObjectRequest(nHash); } if (pfrom->nVersion < MIN_GOVERNANCE_PEER_PROTO_VERSION) { @@ -210,7 +210,7 @@ void CGovernanceManager::ProcessMessage(CNode* pfrom, const std::string& strComm { LOCK(cs_main); - connman.RemoveAskFor(nHash); + EraseObjectRequest(nHash); } if (pfrom->nVersion < MIN_GOVERNANCE_PEER_PROTO_VERSION) { diff --git a/src/llmq/quorums_blockprocessor.cpp b/src/llmq/quorums_blockprocessor.cpp index 86ab347521..57ac4fc685 100644 --- a/src/llmq/quorums_blockprocessor.cpp +++ b/src/llmq/quorums_blockprocessor.cpp @@ -36,7 +36,7 @@ void CQuorumBlockProcessor::ProcessMessage(CNode* pfrom, const std::string& strC auto hash = ::SerializeHash(qc); { LOCK(cs_main); - connman.RemoveAskFor(hash); + EraseObjectRequest(hash); } if (qc.IsNull()) { diff --git a/src/llmq/quorums_chainlocks.cpp b/src/llmq/quorums_chainlocks.cpp index c43055505e..148993a605 100644 --- a/src/llmq/quorums_chainlocks.cpp +++ b/src/llmq/quorums_chainlocks.cpp @@ -103,7 +103,7 @@ void CChainLocksHandler::ProcessNewChainLock(NodeId from, const llmq::CChainLock { { LOCK(cs_main); - g_connman->RemoveAskFor(hash); + EraseObjectRequest(hash); } { diff --git a/src/llmq/quorums_dkgsessionhandler.cpp b/src/llmq/quorums_dkgsessionhandler.cpp index 45453f12cc..f80297c6bb 100644 --- a/src/llmq/quorums_dkgsessionhandler.cpp +++ b/src/llmq/quorums_dkgsessionhandler.cpp @@ -50,7 +50,7 @@ void CDKGPendingMessages::PushPendingMessage(NodeId from, CDataStream& vRecv) return; } - g_connman->RemoveAskFor(hash); + EraseObjectRequest(hash); pendingMessages.emplace_back(std::make_pair(from, std::move(pm))); } @@ -443,7 +443,7 @@ bool ProcessPendingMessageBatch(CDKGSession& session, CDKGPendingMessages& pendi auto hash = ::SerializeHash(msg); { LOCK(cs_main); - g_connman->RemoveAskFor(hash); + EraseObjectRequest(hash); } bool ban = false; diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index 6e7a7bbf2c..9f2be1855b 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -880,7 +880,7 @@ void CInstantSendManager::ProcessInstantSendLock(NodeId from, const uint256& has { { LOCK(cs_main); - g_connman->RemoveAskFor(hash); + EraseObjectRequest(hash); } CTransactionRef tx; diff --git a/src/llmq/quorums_signing.cpp b/src/llmq/quorums_signing.cpp index 79c1b7fc1c..663ff7110c 100644 --- a/src/llmq/quorums_signing.cpp +++ b/src/llmq/quorums_signing.cpp @@ -669,7 +669,7 @@ void CSigningManager::ProcessRecoveredSig(NodeId nodeId, const CRecoveredSig& re { LOCK(cs_main); - connman.RemoveAskFor(recoveredSig.GetHash()); + EraseObjectRequest(recoveredSig.GetHash()); } if (db.HasRecoveredSigForHash(recoveredSig.GetHash())) { diff --git a/src/net.cpp b/src/net.cpp index 8fc258e820..3803ba56cf 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -3054,16 +3054,6 @@ void CConnman::RelayInvFiltered(CInv &inv, const uint256& relatedTxHash, const i } } -void CConnman::RemoveAskFor(const uint256& hash) -{ - mapAlreadyAskedFor.erase(hash); - - LOCK(cs_vNodes); - for (const auto& pnode : vNodes) { - pnode->RemoveAskFor(hash); - } -} - void CConnman::RecordBytesRecv(uint64_t bytes) { LOCK(cs_totalBytesRecv); @@ -3269,14 +3259,6 @@ CNode::~CNode() CloseSocket(hSocket); } -void CNode::RemoveAskFor(const uint256& hash) -{ - setAskFor.erase(hash); - // we don't really remove it from queueAskFor as it would be too expensive to rebuild the heap - // instead, we're ignoring the entry later as it won't be found in setAskForInQueue anymore - setAskForInQueue.erase(hash); -} - bool CConnman::NodeFullyConnected(const CNode* pnode) { return pnode && pnode->fSuccessfullyConnected && !pnode->fDisconnect; diff --git a/src/net.h b/src/net.h index b0ac6feeff..66c177ff89 100644 --- a/src/net.h +++ b/src/net.h @@ -353,7 +353,6 @@ public: void RelayInvFiltered(CInv &inv, const CTransaction &relatedTx, const int minProtoVersion = MIN_PEER_PROTO_VERSION, bool fAllowMasternodeConnections = false); // This overload will not update node filters, so use it only for the cases when other messages will update related transaction data in filters void RelayInvFiltered(CInv &inv, const uint256 &relatedTxHash, const int minProtoVersion = MIN_PEER_PROTO_VERSION, bool fAllowMasternodeConnections = false); - void RemoveAskFor(const uint256& hash); // Addrman functions size_t GetAddressCount() const; @@ -1029,8 +1028,6 @@ public: vBlockHashesToAnnounce.push_back(hash); } - void RemoveAskFor(const uint256& hash); - void CloseSocketDisconnect(); void copyStats(CNodeStats &stats); diff --git a/src/spork.cpp b/src/spork.cpp index acbb1d5fb8..d919c24a05 100644 --- a/src/spork.cpp +++ b/src/spork.cpp @@ -131,7 +131,7 @@ void CSporkManager::ProcessSpork(CNode* pfrom, const std::string& strCommand, CD std::string strLogMsg; { LOCK(cs_main); - connman.RemoveAskFor(hash); + EraseObjectRequest(hash); if(!chainActive.Tip()) return; strLogMsg = strprintf("SPORK -- hash: %s id: %d value: %10d bestHeight: %d peer=%d", hash.ToString(), spork.nSporkID, spork.nValue, chainActive.Height(), pfrom->GetId()); }