tapyrus-core
tapyrus-core copied to clipboard
Security fix 4 - Simplify node time and network-adjusted time warning logic
Port fix of vulnerability fix of CVE-2020-14198 which was changed later by PR 29623(Simplify network-adjusted time warning logic)
As this PR removes the timeoffset
previously defined in each node, the notion of 'adjusted time' is also removed. So a unified std::chrono::system_clock
is used to get the time in GetTime, GetAdjustedTime, GetSystemTimeInSeconds, GetTimeMillis and GetTimeMicros.
-
GetAdjustedTime
andGetTime
are now the same. They return the mockable system time. -
GetSystemTimeInSeconds
does not allow mocktime. This is essential as the p2p layer depends heavily on the connection and message time. Any change to this time due to mocking in tests results in unpredictable behaviour.