|
|
|
@ -25,6 +25,13 @@ logger = logging.getLogger("TestFramework.utils")
|
|
|
|
|
# Assert functions
|
|
|
|
|
##################
|
|
|
|
|
|
|
|
|
|
def assert_approx(v, vexp, vspan=0.00001):
|
|
|
|
|
"""Assert that `v` is within `vspan` of `vexp`"""
|
|
|
|
|
if v < vexp - vspan:
|
|
|
|
|
raise AssertionError("%s < [%s..%s]" % (str(v), str(vexp - vspan), str(vexp + vspan)))
|
|
|
|
|
if v > vexp + vspan:
|
|
|
|
|
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)
|
|
|
|
|