[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Remove MIN_METHOD_FOR_{SHARED_RANDOM, EXCLUDING_INVALID_NODES}



commit 5f90d28c01960921ad1cd680ba7e1275a44345c0
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Mon Apr 9 15:07:51 2018 -0400

    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.
---
 src/or/dirvote.c     |  5 ++---
 src/or/dirvote.h     |  8 --------
 src/or/routerparse.c |  3 +--
 src/test/test_dir.c  | 16 ++--------------
 4 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index 6b553083b..25ca961fa 100644
--- a/src/or/dirvote.c
+++ b/src/or/dirvote.c
@@ -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. */
diff --git a/src/or/dirvote.h b/src/or/dirvote.h
index defcdf575..8a317deb4 100644
--- a/src/or/dirvote.h
+++ b/src/or/dirvote.h
@@ -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
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 79499f2e6..1834cfad2 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -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;
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index e5355069a..df5ae2d59 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -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"
@@ -5628,17 +5627,6 @@ test_dir_assumed_flags(void *arg)
 
   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);
   tt_assert(rs->is_flagged_running);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits