Commit 788a777f authored by juga's avatar juga
Browse files

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)
+1 −1
Original line number Diff line number Diff line
@@ -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,