-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Log new headers #27278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Log new headers #27278
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -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); | ||||||||||||
Comment on lines
+3843
to
+3844
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. leaving this style nit in case someone ends up re-touching this in a follow-up, because this makes my eyes burn 😭
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @josibake Our clang-format wouldn't agree. It would revert your diff to what was merged (and propose this change instead). @@ -4224,7 +4224,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
if (received_new_header) {
LogPrintfCategory(BCLog::NET, "Saw new cmpctblock header hash=%s peer=%d\n",
- blockhash.ToString(), pfrom.GetId());
+ blockhash.ToString(), pfrom.GetId());
} |
||||||||||||
|
||||||||||||
if (ActiveChainstate().IsInitialBlockDownload()) { | ||||||||||||
LogPrintLevel(BCLog::VALIDATION, BCLog::Level::Debug, "%s\n", msg); | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This creates a nice flood of messages when running with |
||||||||||||
} else { | ||||||||||||
LogPrintf("%s\n", msg); | ||||||||||||
} | ||||||||||||
|
||||||||||||
return true; | ||||||||||||
} | ||||||||||||
|
||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.