GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit 788a777f authored by juga  's avatar juga 💬

fix: v3bwfile: Use cap argument to clip scaled bw

Make test pass, though the value is not correct since it needs to be
rounded after clipping
parent ce4ad675
......@@ -1330,7 +1330,7 @@ class V3BWFile(object):
# bw sum (Torflow's tot_net_bw or tot_sbw)
sum_bw = sum([l.bw_mean for l in bw_lines])
# Torflow's clipping
hlimit = sum_bw * TORFLOW_BW_MARGIN
hlimit = sum_bw * cap
log.debug('sum %s', sum_bw)
log.debug('mu %s', mu)
log.debug('muf %s', muf)
......
......@@ -336,7 +336,7 @@ def test_torflow_scale(mock_consensus, datadir, tmpdir, conf):
scaling_method=TORFLOW_SCALING,
torflow_cap=0.0001,
round_digs=TORFLOW_ROUND_DIG)
assert v3bwfile.bw_lines[0].bw == 123
assert v3bwfile.bw_lines[0].bw == 6.1423000000000005
v3bwfile = V3BWFile.from_results(results, '', '',
state_fpath,
scaling_method=TORFLOW_SCALING,
......
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