validation: Reword CheckForkWarningConditions and call it also during IBD and at startup

The existing IBD disable was added at a time when CheckForkWarningConditions
did also sophisticated fork detection that could lead to false positives
during IBD (55ed3f1475).

The fork detection logic doesn't exist anymore
(since fa62304c97), so the IBD check is no
longer necessary.

Displaying the log at startup will help node operators diagnose the
problem better.

Also unify log message and alert warning text, since a long invalid chain
could be due to chainstate corruption or an actual consensus incompatibility
with peers. Previously the log assumed the former and the alert the latter.
This commit is contained in:
Martin Zumsande committed 2025-12-02 12:02:07 -05:00
1 parent 2f51951d03
commit 4b47113698
2 files changed
+6 -8

No files matched your search

+1 -2
View File
@@ -25,8 +25,7 @@ FILE_CHARS_DISALLOWED = '/\\?%*:|"<>' if platform.system() == 'Windows' else '/'
UNCONFIRMED_HASH_STRING = 'unconfirmed'
LARGE_WORK_INVALID_CHAIN_WARNING = (
"Warning: We do not appear to fully agree with our peers " # Exclamation mark removed by SanitizeString in AlertNotify
"You may need to upgrade, or other nodes may need to upgrade."
"Warning: Found invalid chain more than 6 blocks longer than our best chain. This could be due to database corruption or consensus incompatibility with peers."
)