diff options
author | David Goulet <dgoulet@torproject.org> | 2016-05-03 11:36:09 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2016-07-01 14:01:41 -0400 |
commit | 0c26a6db7e683c23505c1c9187fd538c7b80ce31 (patch) | |
tree | a1ad7d2b48935a5f02a0abdf520e4e81a02f1268 /src/or/shared_random.h | |
parent | ca6ceec112f05ce68097429089ee428010c8b8d0 (diff) | |
download | tor-0c26a6db7e683c23505c1c9187fd538c7b80ce31.tar.gz tor-0c26a6db7e683c23505c1c9187fd538c7b80ce31.zip |
prop250: Parse votes and consensus
One of the last piece that parses the votes and consensus in order to update
our state and make decision for the SR values.
We need to inform the SR subsystem when we set the current consensus because
this can be called when loaded from file or downloaded from other authorities
or computed.
The voting schedule is used for the SR timings since we are bound to the
voting system.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Signed-off-by: George Kadianakis <desnacked@riseup.net>
Diffstat (limited to 'src/or/shared_random.h')
-rw-r--r-- | src/or/shared_random.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/or/shared_random.h b/src/or/shared_random.h index f1fbe273f1..d52258c6e2 100644 --- a/src/or/shared_random.h +++ b/src/or/shared_random.h @@ -101,6 +101,9 @@ typedef struct sr_commit_t { int sr_init(int save_to_disk); void sr_save_and_cleanup(void); +void sr_act_post_consensus(const networkstatus_t *consensus); +void sr_handle_received_commits(smartlist_t *commits, + crypto_pk_t *voter_key); sr_commit_t *sr_parse_commit(const smartlist_t *args); sr_srv_t *sr_parse_srv(const smartlist_t *args); char *sr_get_string_for_vote(void); @@ -125,9 +128,22 @@ STATIC int reveal_decode(const char *encoded, sr_commit_t *commit); STATIC int commit_has_reveal_value(const sr_commit_t *commit); +STATIC int verify_commit_and_reveal(const sr_commit_t *commit); + STATIC sr_srv_t *get_majority_srv_from_votes(const smartlist_t *votes, int current); +STATIC void save_commit_to_state(sr_commit_t *commit); +STATIC sr_srv_t *srv_dup(const sr_srv_t *orig); +STATIC int commitments_are_the_same(const sr_commit_t *commit_one, + const sr_commit_t *commit_two); +STATIC int commit_is_authoritative(const sr_commit_t *commit, + const char *voter_key); +STATIC int should_keep_commit(const sr_commit_t *commit, + const char *voter_key, + sr_phase_t phase); +STATIC void save_commit_during_reveal_phase(const sr_commit_t *commit); + #endif /* SHARED_RANDOM_PRIVATE */ #endif /* TOR_SHARED_RANDOM_H */ |