Replace uses of CConnman::RemoveAskFor with EraseObjectRequest

This commit is contained in:
Alexander Block 2020-04-06 14:37:11 +02:00
parent 414943b611
commit 004d9224c4
9 changed files with 9 additions and 30 deletions

View File

@ -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) {

View File

@ -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()) {

View File

@ -103,7 +103,7 @@ void CChainLocksHandler::ProcessNewChainLock(NodeId from, const llmq::CChainLock
{
{
LOCK(cs_main);
g_connman->RemoveAskFor(hash);
EraseObjectRequest(hash);
}
{

View File

@ -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;

View File

@ -880,7 +880,7 @@ void CInstantSendManager::ProcessInstantSendLock(NodeId from, const uint256& has
{
{
LOCK(cs_main);
g_connman->RemoveAskFor(hash);
EraseObjectRequest(hash);
}
CTransactionRef tx;

View File

@ -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())) {

View File

@ -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;

View File

@ -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);

View File

@ -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());
}