p2p: enforce cs_main lock when requesting headers

This commit is contained in:
Patrick Lodder 2024-07-03 13:29:02 -04:00
parent 3e64e6f226
commit cedbbeba96
No known key found for this signature in database
GPG Key ID: 7C523F5FBABE80E7

View File

@ -883,6 +883,7 @@ void Misbehaving(NodeId pnode, int howmuch)
// already requesting headers from, unless forced.
void RequestHeadersFrom(CNode* pto, CConnman& connman, const CBlockIndex* pindex, uint256 untilHash, bool fforceQuery)
{
AssertLockHeld(cs_main);
if (pto->nPendingHeaderRequests > 0) {
if (fforceQuery) {
LogPrint("net", "forcing getheaders request (%d) to peer=%d (%d open)\n",