hsv3: Clarify timing sources around hsv3 code
A big source of bugs and confusions (e.g. legacy/trac#26980 (moved), legacy/trac#26930 (moved)) in the HSv3 code stem from the fact that it uses various timing sources to compute time periods, SRV, etc. Some parts of the code use time(NULL)
, others use the current consensus valid-after, and others use the voting-schedule.
The code is currently not clear in which timing source is used in each case. As an example, some functions take as input now
but they only use it to get a live consensus to use its valid-after, but that may confuse a reader that the now
is used as the time source (e.g. should_rotate_descriptors()
that caused the legacy/trac#26930 (moved) confusion).
We should try to clarify and improve the function signatures around the HSv3 codebase on this regard.