Skip to content

Commit a451e83

Browse files
jamesobMacroFake
and
MacroFake
committed
fix: validation: cast now() to seconds for maxtipage comparison
Since faf4487, 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 <[email protected]>
1 parent 48174c0 commit a451e83

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/validation.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,7 @@ bool Chainstate::IsInitialBlockDownload() const
15411541
if (m_chain.Tip()->nChainWork < m_chainman.MinimumChainWork()) {
15421542
return true;
15431543
}
1544-
if (m_chain.Tip()->Time() < NodeClock::now() - m_chainman.m_options.max_tip_age) {
1544+
if (m_chain.Tip()->Time() < Now<NodeSeconds>() - m_chainman.m_options.max_tip_age) {
15451545
return true;
15461546
}
15471547
LogPrintf("Leaving InitialBlockDownload (latching to false)\n");

0 commit comments

Comments
 (0)