MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / LogBlockHeader

Method LogBlockHeader

src/net_processing.cpp:3559–3582  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3557}
3558
3559void PeerManagerImpl::LogBlockHeader(const CBlockIndex& index, const CNode& peer, bool via_compact_block) {
3560 // To prevent log spam, this function should only be called after it was determined that a
3561 // header is both new and valid.
3562 //
3563 // These messages are valuable for detecting potential selfish mining behavior;
3564 // if multiple displacing headers are seen near simultaneously across many
3565 // nodes in the network, this might be an indication of selfish mining.
3566 // In addition it can be used to identify peers which send us a header, but
3567 // don't followup with a complete and valid (compact) block.
3568 // Having this log by default when not in IBD ensures broad availability of
3569 // this data in case investigation is merited.
3570 const auto msg = strprintf(
3571 "Saw new %sheader hash=%s height=%d %s",
3572 via_compact_block ? "cmpctblock " : "",
3573 index.GetBlockHash().ToString(),
3574 index.nHeight,
3575 peer.LogPeer()
3576 );
3577 if (m_chainman.IsInitialBlockDownload()) {
3578 LogDebug(BCLog::VALIDATION, "%s", msg);
3579 } else {
3580 LogInfo("%s", msg);
3581 }
3582}
3583
3584void PeerManagerImpl::PushPrivateBroadcastTx(CNode& node)
3585{

Callers

nothing calls this directly

Calls 4

LogPeerMethod · 0.80
ToStringMethod · 0.45
GetBlockHashMethod · 0.45

Tested by

no test coverage detected