[tor-commits] [sbws/master] fix: relaylist: Convert consensus bandwidth to bytes

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


commit 5c54f0407a37c2dae83fd8d0dfd37405b15f7758
Author: juga0 <juga at riseup.net>
Date:   Sat Mar 9 12:31:14 2019 +0000

    fix: relaylist: Convert consensus bandwidth to bytes
    
    Since all the other bandwidth values are in bytes and sbws should
    work with bytes until it generates the final `bw`.
    
    Closes: #29707. Bugfix v1.0.3.
---
 sbws/lib/relaylist.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sbws/lib/relaylist.py b/sbws/lib/relaylist.py
index 880f88e..a4dc7fa 100644
--- a/sbws/lib/relaylist.py
+++ b/sbws/lib/relaylist.py
@@ -120,7 +120,12 @@ class Relay:
 
     @property
     def consensus_bandwidth(self):
-        return self._from_ns('bandwidth')
+        """Return the consensus bandwidth in Bytes.
+
+        Consensus bandwidth is the only bandwidth value that is in kilobytes.
+        """
+        if self._from_ns('bandwidth') is not None:
+            return self._from_ns('bandwidth') * 1000
 
     @property
     def consensus_bandwidth_is_unmeasured(self):





More information about the tor-commits mailing list