|
|
|
@ -371,19 +371,17 @@ void MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid, CConnman* connman) {
@@ -371,19 +371,17 @@ void MaybeSetPeerAsAnnouncingHeaderAndIDs(NodeId nodeid, CConnman* connman) {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
connman->ForNode(nodeid, [connman](CNode* pfrom){ |
|
|
|
|
bool fAnnounceUsingCMPCTBLOCK = false; |
|
|
|
|
uint64_t nCMPCTBLOCKVersion = (pfrom->GetLocalServices() & NODE_WITNESS) ? 2 : 1; |
|
|
|
|
if (lNodesAnnouncingHeaderAndIDs.size() >= 3) { |
|
|
|
|
// As per BIP152, we only get 3 of our peers to announce
|
|
|
|
|
// blocks using compact encodings.
|
|
|
|
|
connman->ForNode(lNodesAnnouncingHeaderAndIDs.front(), [connman, fAnnounceUsingCMPCTBLOCK, nCMPCTBLOCKVersion](CNode* pnodeStop){ |
|
|
|
|
connman->PushMessage(pnodeStop, CNetMsgMaker(pnodeStop->GetSendVersion()).Make(NetMsgType::SENDCMPCT, fAnnounceUsingCMPCTBLOCK, nCMPCTBLOCKVersion)); |
|
|
|
|
connman->ForNode(lNodesAnnouncingHeaderAndIDs.front(), [connman, nCMPCTBLOCKVersion](CNode* pnodeStop){ |
|
|
|
|
connman->PushMessage(pnodeStop, CNetMsgMaker(pnodeStop->GetSendVersion()).Make(NetMsgType::SENDCMPCT, /*fAnnounceUsingCMPCTBLOCK=*/false, nCMPCTBLOCKVersion)); |
|
|
|
|
return true; |
|
|
|
|
}); |
|
|
|
|
lNodesAnnouncingHeaderAndIDs.pop_front(); |
|
|
|
|
} |
|
|
|
|
fAnnounceUsingCMPCTBLOCK = true; |
|
|
|
|
connman->PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::SENDCMPCT, fAnnounceUsingCMPCTBLOCK, nCMPCTBLOCKVersion)); |
|
|
|
|
connman->PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()).Make(NetMsgType::SENDCMPCT, /*fAnnounceUsingCMPCTBLOCK=*/true, nCMPCTBLOCKVersion)); |
|
|
|
|
lNodesAnnouncingHeaderAndIDs.push_back(pfrom->GetId()); |
|
|
|
|
return true; |
|
|
|
|
}); |
|
|
|
|