[tor-commits] [doctor/master] Only check relays in consensus for bw auth measurements

atagar at torproject.org atagar at torproject.org
Wed Sep 3 14:16:52 UTC 2014


commit 934fa9ae2060b24f3250ea462465832e74272f6d
Author: Damian Johnson <atagar at torproject.org>
Date:   Wed Sep 3 07:17:41 2014 -0700

    Only check relays in consensus for bw auth measurements
    
    Request from Sebastian to only count relays that ended up in the consensus when
    determining how many measured/unmeasured relays there are...
    
      https://trac.torproject.org/projects/tor/ticket/13046
---
 consensus_health_checker.py |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/consensus_health_checker.py b/consensus_health_checker.py
index e3cc7bf..a90cde3 100755
--- a/consensus_health_checker.py
+++ b/consensus_health_checker.py
@@ -489,16 +489,20 @@ def unmeasured_relays(latest_consensus, consensuses, votes):
   "Checks that the bandwidth authorities have all formed an opinion about at least 90% of the relays."
 
   issues = []
+  consensus_fingerprints = set([desc.fingerprint for desc in latest_consensus.routers.values()])
 
   for authority, vote in votes.items():
     if authority in CONFIG['bandwidth_authorities']:
-      unmeasured = 0
+      measured, unmeasured = 0, 0
 
       for desc in vote.routers.values():
-        if not desc.measured:
-          unmeasured += 1
+        if desc.fingerprint in consensus_fingerprints:
+          if desc.measured:
+            measured += 1
+          else:
+            unmeasured += 1
 
-      total = len(vote.routers)
+      total = measured + unmeasured
       percentage = 100 * unmeasured / total
 
       if percentage >= 5:



More information about the tor-commits mailing list