@@ -1328,9 +1328,10 @@ void PeerLogicValidation::UpdatedBlockTip(const CBlockIndex *pindexNew, const CB
13281328 }
13291329 // Relay inventory, but don't relay old inventory during initial block download.
13301330 connman->ForEachNode ([nNewHeight, &vHashes](CNode* pnode) {
1331+ LOCK (pnode->cs_inventory );
13311332 if (nNewHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : 0 )) {
13321333 for (const uint256& hash : reverse_iterate (vHashes)) {
1333- pnode->PushBlockHash (hash);
1334+ pnode->vBlockHashesToAnnounce . push_back (hash);
13341335 }
13351336 }
13361337 });
@@ -1607,7 +1608,7 @@ void static ProcessGetBlockData(CNode& pfrom, const CChainParams& chainparams, c
16071608 // Trigger the peer node to send a getblocks request for the next batch of inventory
16081609 if (inv.hash == pfrom.hashContinue )
16091610 {
1610- // Bypass PushBlockInventory, this must send even if redundant,
1611+ // Send immediately. This must send even if redundant,
16111612 // and we want it right after the last block so they don't
16121613 // wait for other stuff first.
16131614 std::vector<CInv> vInv;
@@ -2666,7 +2667,7 @@ void ProcessMessage(
26662667 LogPrint (BCLog::NET, " getblocks stopping, pruned or too old block at %d %s\n " , pindex->nHeight , pindex->GetBlockHash ().ToString ());
26672668 break ;
26682669 }
2669- pfrom.PushBlockInventory (pindex->GetBlockHash ());
2670+ WITH_LOCK ( pfrom.cs_inventory , pfrom. vInventoryBlockToSend . push_back (pindex->GetBlockHash () ));
26702671 if (--nLimit <= 0 )
26712672 {
26722673 // When this block is requested, we'll send an inv that'll
@@ -4083,7 +4084,7 @@ bool PeerLogicValidation::SendMessages(CNode* pto)
40834084
40844085 // If the peer's chain has this block, don't inv it back.
40854086 if (!PeerHasHeader (&state, pindex)) {
4086- pto->PushBlockInventory (hashToAnnounce);
4087+ pto->vInventoryBlockToSend . push_back (hashToAnnounce);
40874088 LogPrint (BCLog::NET, " %s: sending inv peer=%d hash=%s\n " , __func__,
40884089 pto->GetId (), hashToAnnounce.ToString ());
40894090 }
0 commit comments