MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / announceWithBlock

Method announceWithBlock

src/blockannounce.cpp:266–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266void BlockAnnounceSender::announceWithBlock(BlockSender& sender) {
267 assert(to.blocksToAnnounce.size() == 1);
268 uint256 hash = to.blocksToAnnounce[0];
269 CBlockIndex* block = mapBlockIndex.find(hash)->second;
270
271 if (peerHasHeader(block)) {
272 // peer may have announced this block to us.
273 return;
274 }
275
276 sender.sendBlock(to, *block, MSG_CMPCT_BLOCK, block->nHeight);
277 UpdateBestHeaderSent(to, block);
278
279 LogPrint("net", "%s: block %s to peer=%d\n",
280 __func__, hash.ToString(), to.id);
281}
282
283void BlockAnnounceSender::announce() {
284 LOCK(to.cs_inventory);

Callers

nothing calls this directly

Calls 5

UpdateBestHeaderSentFunction · 0.85
findMethod · 0.80
sizeMethod · 0.45
sendBlockMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected