[tor-commits] [sbws/master] new: v3bwfile: Include relay consensus count

juga at torproject.org juga at torproject.org
Thu Mar 21 18:30:42 UTC 2019


commit 6047da5c4a9b55139f66a8974e20bb0c81a95d4b
Author: juga0 <juga at riseup.net>
Date:   Fri Feb 8 09:18:14 2019 +0000

    new: v3bwfile: Include relay consensus count
    
    Include a KeyValue in each bandwidth line with the number of
    times the relay has been in a consensus in the past days.
    
    Part of #28566.
---
 sbws/lib/v3bwfile.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sbws/lib/v3bwfile.py b/sbws/lib/v3bwfile.py
index d6c545a..d827029 100644
--- a/sbws/lib/v3bwfile.py
+++ b/sbws/lib/v3bwfile.py
@@ -404,6 +404,11 @@ class V3BWLine(object):
             kwargs['master_key_ed25519'] = results[0].master_key_ed25519
         kwargs['time'] = cls.last_time_from_results(results)
         kwargs.update(cls.result_types_from_results(results))
+        consensuses_count = [r.consensus_count for r in results
+                             if getattr(r, 'consensus_count', None)]
+        if consensuses_count:
+            consensus_count = max(consensuses_count)
+            kwargs['relay_in_recent_consensus_count'] = consensus_count
 
         success_results = [r for r in results if isinstance(r, ResultSuccess)]
         if not success_results:





More information about the tor-commits mailing list