From 9fb18756df3f76545f8f591881a95e1e09e735a0 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 24 Feb 2020 11:06:44 -0500 Subject: Stop using all dirauth-only options in shared_random_client.c This is not as clean a patch as I would like: see the comment on ASSUME_AUTHORITY_SCHEDULING. This issue here is that the unit tests sometimes assume that we are going to be looking at the dirauth options and behaving like a dirauth, but without setting the options to turn is into one. This isn't an issue for actually running Tor, as far as I can tell with chutney. --- src/feature/dirauth/voting_schedule.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/feature/dirauth/voting_schedule.c') diff --git a/src/feature/dirauth/voting_schedule.c b/src/feature/dirauth/voting_schedule.c index 5e076a0ef5..ddb2c4bb07 100644 --- a/src/feature/dirauth/voting_schedule.c +++ b/src/feature/dirauth/voting_schedule.c @@ -51,6 +51,7 @@ create_voting_schedule(const or_options_t *options, time_t now, int severity) } tor_assert(interval > 0); + new_voting_schedule->interval = interval; if (vote_delay + dist_delay > interval/2) vote_delay = dist_delay = interval / 4; @@ -143,6 +144,24 @@ dirauth_sched_get_next_valid_after_time(void) return dirauth_get_voting_schedule()->interval_starts; } +/** + * Return our best idea of what the valid-after time for the _current_ + * consensus, whether we have one or not. + * + * Dirauth only. + **/ +time_t +dirauth_sched_get_cur_valid_after_time(void) +{ + const voting_schedule_t *sched = dirauth_get_voting_schedule(); + time_t next_start = sched->interval_starts; + int interval = sched->interval; + int offset = get_options()->TestingV3AuthVotingStartOffset; + return voting_sched_get_start_of_interval_after(next_start - interval - 1, + interval, + offset); +} + /** Return the voting interval that we are configured to use. * * Dirauth only. */ -- cgit v1.2.3-54-g00ecf