Skip to content

Commit

Permalink
Decouple block processing cs_main lock from the rest of inv get data …
Browse files Browse the repository at this point in the history
…requests
  • Loading branch information
furszy committed Feb 21, 2021
1 parent da7c0f7 commit 31c7974
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,8 @@ bool static IsTierTwoInventoryTypeKnown(int type)

void static ProcessGetData(CNode* pfrom, CConnman& connman, const std::atomic<bool>& interruptMsgProc)
{
AssertLockNotHeld(cs_main);

std::deque<CInv>::iterator it = pfrom->vRecvGetData.begin();
std::vector<CInv> vNotFound;
CNetMsgMaker msgMaker(pfrom->GetSendVersion());
Expand Down Expand Up @@ -957,15 +959,15 @@ void static ProcessGetData(CNode* pfrom, CConnman& connman, const std::atomic<bo

// todo: inventory signal
}
} // release cs_main

if (it != pfrom->vRecvGetData.end()) {
const CInv &inv = *it;
it++;
if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK) {
ProcessGetBlockData(pfrom, inv, connman, interruptMsgProc);
}
if (it != pfrom->vRecvGetData.end()) {
const CInv &inv = *it;
it++;
if (inv.type == MSG_BLOCK || inv.type == MSG_FILTERED_BLOCK) {
ProcessGetBlockData(pfrom, inv, connman, interruptMsgProc);
}
} // release cs_main
}

pfrom->vRecvGetData.erase(pfrom->vRecvGetData.begin(), it);

Expand Down

0 comments on commit 31c7974

Please sign in to comment.