Skip to content

Commit b76d9b3

Browse files
committed
pytest: test for fetchinvoice when a onion-message-capable peer is disconnected.
``` FAILED tests/test_pay.py::test_fetchinvoice_autoconnect_if_disconnected - pyln.client.lightning.RpcError: RPC call failed: method: fetchinvoice, payload: {'offer': 'lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqypq5tn5v4ehghmxv46xx6rfdemx76trv40kzat5da3k7mnwv43hghmfve0kg6tnvdhkumn9vd6x2ep3zcssxhftzxfdlwsnfcgw2sy8t5mxa0ytcdfat2nkdwqvpy9nnsa9mzza'}, error: {'code': -1, 'message': 'onion msg: unknown next peer 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59'} ``` Signed-off-by: Rusty Russell <[email protected]>
1 parent 1d513c2 commit b76d9b3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_pay.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4784,6 +4784,19 @@ def test_fetchinvoice_autoconnect(node_factory, bitcoind):
47844784
assert l3.rpc.listpeers(l2.info['id'])['peers'] != []
47854785

47864786

4787+
def test_fetchinvoice_autoconnect_if_disconnected(node_factory, bitcoind):
4788+
"""If peer is disconnected, we should NOT try to use it"""
4789+
l1, l2, l3 = node_factory.line_graph(3, wait_for_announce=True,
4790+
opts={'dev-allow-localhost': None})
4791+
4792+
offer = l3.rpc.offer(amount='2msat', description='test_fetchinvoice_autoconnect_if_disconnected1')['bolt12']
4793+
l1.rpc.fetchinvoice(offer)
4794+
4795+
l1.rpc.disconnect(l2.info['id'], force=True)
4796+
l1.rpc.fetchinvoice(offer)
4797+
4798+
4799+
@pytest.mark.xfail(strict=True)
47874800
def test_fetchinvoice_disconnected_reply(node_factory, bitcoind):
47884801
"""We ask for invoice, but reply path doesn't lead directly from recipient"""
47894802
l1, l2, l3 = node_factory.get_nodes(3,

0 commit comments

Comments
 (0)