Skip to content

Commit

Permalink
tests: add pay test over unannounced channels
Browse files Browse the repository at this point in the history
This test fails with cln v24.08.2. Add this test, so it doesn't happen
again.

Changelog-None
  • Loading branch information
JssDWt committed Nov 19, 2024
1 parent ba7bf33 commit f3c98b7
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_pay.py
Original file line number Diff line number Diff line change
Expand Up @@ -6733,3 +6733,26 @@ def test_fetchinvoice_with_payer_metadata(node_factory, bitcoind):
inv3 = l1.rpc.call('fetchinvoice', {'offer': offer['bolt12'], 'amount_msat': '1sat', 'payer_note': 'Payment For vincenzopalazzo', 'payer_metadata': b'macros'.hex()})['invoice']
decode3 = l1.rpc.call('decode', {'string': inv3})
assert decode1['invreq_payer_id'] == decode3['invreq_payer_id']


def test_pay_unannounced_routehint(node_factory, bitcoind):
"""Tests whether sender can pay recipient through unannounced channels with
2 hops where the second hop uses a route hint."""

l1, l2, l3, r1, r2 = node_factory.get_nodes(5)

# l1 and l3 are connected with unannounced channels to l2
node_factory.join_nodes([l1, l2], announce_channels=False)
node_factory.join_nodes([l2, l3], announce_channels=False)

# Need these to ensure l3 adds a route hint in the invoice
node_factory.join_nodes([l2, r1], wait_for_announce=True)
node_factory.join_nodes([l2, r2], wait_for_announce=True)

# Ensure recipient sees the channels
wait_for(lambda: len(l3.rpc.listchannels(destination=r1.info['id'])['channels']) > 0)
wait_for(lambda: len(l3.rpc.listchannels(destination=r2.info['id'])['channels']) > 0)

inv = l3.rpc.invoice(2100000, 'receive', 'receive')
l1.rpc.pay(inv['bolt11'])
wait_for(lambda: l1.rpc.listpays(inv['bolt11'])['pays'][0]['status'] == 'complete')

0 comments on commit f3c98b7

Please sign in to comment.