Remove MIN_METHOD_FOR_{SHARED_RANDOM,EXCLUDING_INVALID_NODES}

Also remove client detection for pre-EXCLUDING_INVALID_NODES
consensuses, and a test for that detection.
This commit is contained in:
Nick Mathewson 2018-04-09 15:07:51 -04:00
parent 73c9c16faa
commit 5f90d28c01
4 changed files with 5 additions and 27 deletions

View File

@ -1524,7 +1524,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
smartlist_add_strdup(chunks, "\n");
}
if (consensus_method >= MIN_METHOD_FOR_SHARED_RANDOM) {
{
int num_dirauth = get_n_authorities(V3_DIRINFO);
/* Default value of this is 2/3 of the total number of authorities. For
* instance, if we have 9 dirauth, the default value is 6. The following
@ -1935,8 +1935,7 @@ networkstatus_compute_consensus(smartlist_t *votes,
/* Starting with consensus method 24, we don't list servers
* that are not valid in a consensus. See Proposal 272 */
if (!is_valid &&
consensus_method >= MIN_METHOD_FOR_EXCLUDING_INVALID_NODES)
if (!is_valid)
continue;
/* Pick the version. */

View File

@ -61,14 +61,6 @@
/** The highest consensus method that we currently support. */
#define MAX_SUPPORTED_CONSENSUS_METHOD 28
/** Lowest consensus method where authorities may include a shared random
* value(s). */
#define MIN_METHOD_FOR_SHARED_RANDOM 23
/** Lowest consensus method where authorities drop all nodes that don't get
* the Valid flag. */
#define MIN_METHOD_FOR_EXCLUDING_INVALID_NODES 24
/** Lowest consensus method where authorities vote on required/recommended
* protocols. */
#define MIN_METHOD_FOR_RECOMMENDED_PROTOCOLS 25

View File

@ -2743,8 +2743,7 @@ routerstatus_parse_entry_from_string(memarea_t *area,
/* These are implied true by having been included in a consensus made
* with a given method */
rs->is_flagged_running = 1; /* Starting with consensus method 4. */
if (consensus_method >= MIN_METHOD_FOR_EXCLUDING_INVALID_NODES)
rs->is_valid = 1;
rs->is_valid = 1; /* Starting with consensus method 24. */
}
{
const char *protocols = NULL, *version = NULL;

View File

@ -5617,9 +5617,8 @@ test_dir_assumed_flags(void *arg)
memarea_t *area = memarea_new();
routerstatus_t *rs = NULL;
/* First, we should always assume that the Running flag is set, even
* when it isn't listed, since the consensus method is always
* higher than 4. */
/* We can assume that consensus method is higher than 24, so Running and
* Valid are always implicitly set */
const char *str1 =
"r example hereiswhereyouridentitygoes 2015-08-30 12:00:00 "
"192.168.0.1 9001 0\n"
@ -5627,17 +5626,6 @@ test_dir_assumed_flags(void *arg)
"s Fast Guard Stable\n";
const char *cp = str1;
rs = routerstatus_parse_entry_from_string(area, &cp, tokens, NULL, NULL,
23, FLAV_MICRODESC);
tt_assert(rs);
tt_assert(rs->is_flagged_running);
tt_assert(! rs->is_valid);
tt_assert(! rs->is_exit);
tt_assert(rs->is_fast);
routerstatus_free(rs);
/* With method 24 or later, we can assume "valid" is set. */
cp = str1;
rs = routerstatus_parse_entry_from_string(area, &cp, tokens, NULL, NULL,
24, FLAV_MICRODESC);
tt_assert(rs);