Skip to content

Commit da5a16b

Browse files
gmaxwelllaanwj
authored andcommitted
Always drop the least preferred HB peer when adding a new one.
When a BIP152 HB-mode peer is in the least preferred position and disconnects, they will not be by ForNode on the next loop. They will continue to sit in that position and prevent deactivating HB mode for peers that are still connected. There is no reason for them to stay in the list if already gone, so drop the first element unconditionally if there are too many. Fixes issue #9163. Github-Pull: #9199 Rebased-From: ca8549d2bd32f17f8b69d1edbe3f2976fba504b4
1 parent 094848b commit da5a16b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,8 @@ void MaybeSetPeerAsAnnouncingHeaderAndIDs(const CNodeState* nodestate, CNode* pf
510510
CNode* pnodeStop = FindNode(lNodesAnnouncingHeaderAndIDs.front());
511511
if (pnodeStop) {
512512
pnodeStop->PushMessage(NetMsgType::SENDCMPCT, fAnnounceUsingCMPCTBLOCK, nCMPCTBLOCKVersion);
513-
lNodesAnnouncingHeaderAndIDs.pop_front();
514513
}
514+
lNodesAnnouncingHeaderAndIDs.pop_front();
515515
}
516516
fAnnounceUsingCMPCTBLOCK = true;
517517
pfrom->PushMessage(NetMsgType::SENDCMPCT, fAnnounceUsingCMPCTBLOCK, nCMPCTBLOCKVersion);

0 commit comments

Comments
 (0)