Commit 54afe753 authored by juga  's avatar juga
Browse files

v3bwfile, resultdump: support results without new bw

When parsing results support old ones without new bandwidth
attributes, as descriptor bandwidth burst, consensus_bandwidth
and consensus bandwidth is unmeasured.
parent 619c2f46
......@@ -54,7 +54,7 @@ def gen_parser(sub):
p.add_argument('-m', '--torflow-bw-margin', default=TORFLOW_BW_MARGIN,
help="Cap maximum bw when scaling as Torflow. ")
p.add_argument('-r', '--round-digs', '--torflow-round-digs',
p.add_argument('-r', '--torflow-round-digs',
default=PROP276_ROUND_DIG, type=int,
help="Number of most significant digits to round bw.")
p.add_argument('-p', '--secs-recent', default=None, type=int,
......@@ -501,9 +501,9 @@ class ResultSuccess(Result):
d['fingerprint'], d['nickname'], d['address'],
d['master_key_ed25519'], d['relay_average_bandwidth'],
d['relay_burst_bandwidth'], d['relay_observed_bandwidth'],
d.get('relay_burst_bandwidth'), d['relay_observed_bandwidth'],
d['circ'], d['dest_url'], d['scanner'],
......@@ -848,8 +848,15 @@ class V3BWFile(object):
# descriptors' bandwidth-observed, because that penalises new
# relays.
# See
desc_bw = min(desc_bw_obs, l.desc_bw_bur, l.desc_bw_avg)
if l.consensus_bandwidth_is_unmeasured:
if l.desc_bw_bur is not None:
# Because in previous versions results were not storing
# desc_bw_bur
desc_bw = min(desc_bw_obs, l.desc_bw_bur, l.desc_bw_avg)
desc_bw = min(desc_bw_obs, l.desc_bw_avg)
# In previous versions results were not storing consensus_bandwidth
if l.consensus_bandwidth_is_unmeasured \
or l.consensus_bandwidth is None:
min_bandwidth = desc_bw
# If the relay is measured, use the minimum between the descriptors
# bandwidth and the consensus bandwidth, so that
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment