diff --git a/tests/test_closing.py b/tests/test_closing.py index d4adfecc1..9c17eebc1 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -6,7 +6,7 @@ from pyln.testing.utils import SLOW_MACHINE from utils import ( only_one, sync_blockheight, wait_for, TIMEOUT, account_balance, first_channel_id, closing_fee, TEST_NETWORK, - scriptpubkey_addr + scriptpubkey_addr, calc_lease_fee ) import os @@ -718,14 +718,6 @@ def test_penalty_outhtlc(node_factory, bitcoind, executor, chainparams): assert account_balance(l2, channel_id) == 0 -# check that the fee paid is correct -def calc_lease_fee(amt, feerate, rates): - fee = rates['lease_fee_base_msat'] - fee += amt * rates['lease_fee_basis'] // 10 - fee += rates['funding_weight'] * feerate - return fee - - @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') @pytest.mark.openchannel('v2') @pytest.mark.slow_test diff --git a/tests/test_opening.py b/tests/test_opening.py index 1d688b5a9..cdd351e2d 100644 --- a/tests/test_opening.py +++ b/tests/test_opening.py @@ -2,7 +2,7 @@ from fixtures import * # noqa: F401,F403 from fixtures import TEST_NETWORK from pyln.client import RpcError, Millisatoshi from utils import ( - only_one, wait_for, sync_blockheight, first_channel_id + only_one, wait_for, sync_blockheight, first_channel_id, calc_lease_fee ) import pytest diff --git a/tests/utils.py b/tests/utils.py index 81f34f111..a21851b20 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -74,6 +74,13 @@ def move_matches(exp, mv): return True +def calc_lease_fee(amt, feerate, rates): + fee = rates['lease_fee_base_msat'] + fee += amt * rates['lease_fee_basis'] // 10 + fee += rates['funding_weight'] * feerate + return fee + + def check_coin_moves(n, account_id, expected_moves, chainparams): moves = n.rpc.call('listcoinmoves_plugin')['coin_moves'] node_id = n.info['id']