mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
tests: promote method to utility file
We'll reuse it later
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user