From a451e832b46bcb984dfcd9478ea8ebb8b3de0c62 Mon Sep 17 00:00:00 2001 From: James O'Beirne Date: Wed, 9 Nov 2022 12:07:23 -0500 Subject: [PATCH] fix: validation: cast now() to seconds for maxtipage comparison Since faf44876db555f7488c8df96db9fa88b793f897c, the maxtipage comparison in IsInitialBlockDownload() has been broken, since the NodeClock::now() time_point is in the system's native denomination (micrcoseconds). Without this patch, specifying the maximum allowable -maxtipage (9223372036854775807) results in a SIGABRT crash. Co-authored-by: MacroFake --- src/validation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/validation.cpp b/src/validation.cpp index debdc2ae749..bd298959f8c 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1541,7 +1541,7 @@ bool Chainstate::IsInitialBlockDownload() const if (m_chain.Tip()->nChainWork < m_chainman.MinimumChainWork()) { return true; } - if (m_chain.Tip()->Time() < NodeClock::now() - m_chainman.m_options.max_tip_age) { + if (m_chain.Tip()->Time() < Now() - m_chainman.m_options.max_tip_age) { return true; } LogPrintf("Leaving InitialBlockDownload (latching to false)\n");