Logic error with monthly accounting
Here's the code in src/or/hibernate.c:
/* If this is before the Nth, we want the Nth of last month. */
if (tm.tm_mday < cfg_start_day ||
(tm.tm_mday < cfg_start_day && before)) {
--tm.tm_mon;
}
Andrey Karpov points out in https://www.viva64.com/en/b/0507/ that the second clause of the if is redundant with the first clause.
Looking at it more, I think we wanted that second clause to be (tm.tm_mday == cfg_start_day && before)
.
What are the implications of this bug for relays that do monthly accounting?