From b89d2fa1db2379bffd2e2b4c851c3facc57b6ed8 Mon Sep 17 00:00:00 2001 From: George Kadianakis Date: Fri, 4 Aug 2017 12:21:14 +0300 Subject: Don't set HSDir index if we don't have a live consensus. We also had to alter the SRV functions to take a consensus as optional input, since we might be setting our HSDir index using a consensus that is currently being processed and won't be returned by the networkstatus_get_live_consensus() function. This change has two results: a) It makes sure we are using a fresh consensus with the right SRV value when we are calculating the HSDir hash ring. b) It ensures that we will not use the sr_get_current/previous() functions when we don't have a consensus which would have falsely triggered the disaster SRV logic. --- src/or/shared_random.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/or/shared_random.h') diff --git a/src/or/shared_random.h b/src/or/shared_random.h index 58ea360df0..76d5b95422 100644 --- a/src/or/shared_random.h +++ b/src/or/shared_random.h @@ -130,8 +130,8 @@ sr_commit_t *sr_generate_our_commit(time_t timestamp, char *sr_get_current_for_control(void); char *sr_get_previous_for_control(void); -const sr_srv_t *sr_get_current(void); -const sr_srv_t *sr_get_previous(void); +const sr_srv_t *sr_get_current(const networkstatus_t *ns); +const sr_srv_t *sr_get_previous(const networkstatus_t *ns); #ifdef SHARED_RANDOM_PRIVATE -- cgit v1.2.3-54-g00ecf