mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-20 14:05:23 +01:00
log: on new valid header
This commit is contained in:
parent
e5ce857634
commit
2c3a90f663
1 changed files with 17 additions and 0 deletions
|
@ -3832,6 +3832,23 @@ bool ChainstateManager::AcceptBlockHeader(const CBlockHeader& block, BlockValida
|
|||
if (ppindex)
|
||||
*ppindex = pindex;
|
||||
|
||||
// Since this is the earliest point at which we have determined that a
|
||||
// header is both new and valid, log here.
|
||||
//
|
||||
// These messages are valuable for detecting potential selfish mining behavior;
|
||||
// if multiple displacing headers are seen near simultaneously across many
|
||||
// nodes in the network, this might be an indication of selfish mining. Having
|
||||
// this log by default when not in IBD ensures broad availability of this data
|
||||
// in case investigation is merited.
|
||||
const auto msg = strprintf(
|
||||
"Saw new header hash=%s height=%d", hash.ToString(), pindex->nHeight);
|
||||
|
||||
if (ActiveChainstate().IsInitialBlockDownload()) {
|
||||
LogPrintLevel(BCLog::VALIDATION, BCLog::Level::Debug, "%s\n", msg);
|
||||
} else {
|
||||
LogPrintf("%s\n", msg);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue