MCPcopy Create free account
hub / github.com/ElementsProject/elements / assert_fee_amount

Function assert_fee_amount

test/functional/test_framework/util.py:49–58  ·  view source on GitHub ↗

Assert the fee is in range.

(fee, tx_size, feerate_BTC_kvB)

Source from the content-addressed store, hash-verified

47
48
49def assert_fee_amount(fee, tx_size, feerate_BTC_kvB):
50 """Assert the fee is in range."""
51 assert isinstance(tx_size, int)
52 target_fee = get_fee(tx_size, feerate_BTC_kvB)
53 if fee < target_fee:
54 raise AssertionError("Fee of %s BTC too low! (Should be %s BTC)" % (str(fee), str(target_fee)))
55 # allow the wallet's estimation to be at most 2 bytes off
56 high_fee = get_fee(tx_size + 2, feerate_BTC_kvB)
57 if fee > high_fee:
58 raise AssertionError("Fee of %s BTC too high! (Should be %s BTC)" % (str(fee), str(target_fee)))
59
60
61def assert_equal(thing1, thing2, *args):

Callers 3

test_option_feerateMethod · 0.90
check_fee_amountMethod · 0.90
run_testMethod · 0.90

Calls 1

get_feeFunction · 0.85

Tested by 1

test_option_feerateMethod · 0.72