diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 59a4d663cc..1d730feb8c 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -36,13 +36,14 @@ def assert_approx(v, vexp, vspan=0.00001): raise AssertionError("%s > [%s..%s]" % (str(v), str(vexp - vspan), str(vexp + vspan))) -def assert_fee_amount(fee, tx_size, fee_per_kB): - """Assert the fee was in range""" - target_fee = round(tx_size * fee_per_kB / 1000, 8) +def assert_fee_amount(fee, tx_size, feerate_DASH_kvB): + """Assert the fee is in range.""" + feerate_DASH_vB = feerate_DASH_kvB / 1000 + target_fee = satoshi_round(tx_size * feerate_DASH_vB) if fee < target_fee: raise AssertionError("Fee of %s DASH too low! (Should be %s DASH)" % (str(fee), str(target_fee))) # allow the wallet's estimation to be at most 2 bytes off - if fee > (tx_size + 2) * fee_per_kB / 1000: + if fee > (tx_size + 2) * feerate_DASH_vB: raise AssertionError("Fee of %s DASH too high! (Should be %s DASH)" % (str(fee), str(target_fee)))