Skip to content

Commit

Permalink
added a simple test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lagrang3 committed Nov 27, 2023
1 parent 50bf987 commit 221a7b6
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/test_renepay.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,3 +360,36 @@ def test_hardmpp(node_factory):
invoice = only_one(l6.rpc.listinvoices('inv2')['invoices'])
assert isinstance(invoice['amount_received_msat'], Millisatoshi)
assert invoice['amount_received_msat'] >= Millisatoshi('1800000sat')

def test_fee_allocation(node_factory):
'''
Topology:
1----2
| |
3----4
This a payment that fails if fee is not allocated as part of the flow
constraints.
'''
# High fees at 4%
opts = [
{'disable-mpp': None, 'fee-base': 1000 , 'fee-per-satoshi': 30000},
]
l1, l2, l3, l4 = node_factory.get_nodes(4, opts=opts * 4)
start_channels([(l1, l2, 1000000), (l2, l4, 2000000),
(l1, l3, 1000000), (l3, l4, 2000000)])

inv = l4.rpc.invoice("1500000sat", "inv", 'description')

out = subprocess.check_output(['cli/lightning-cli',
'--network={}'.format(TEST_NETWORK),
'--lightning-dir={}'
.format(l1.daemon.lightning_dir),
'-k',
'renepay',
'invstring={}'.format(inv['bolt11']),
'maxfee=75000sat',
]).decode('utf-8')
l1.wait_for_htlcs()
invoice = only_one(l4.rpc.listinvoices('inv')['invoices'])
assert isinstance(invoice['amount_received_msat'], Millisatoshi)
assert invoice['amount_received_msat'] >= Millisatoshi('1500000sat')

0 comments on commit 221a7b6

Please sign in to comment.