Assert the fee is in range.
(fee, tx_size, feerate_BTC_kvB)
| 47 | |
| 48 | |
| 49 | def 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 | |
| 61 | def assert_equal(thing1, thing2, *args): |