From fb77c4989b511a2185227bd6aa73fd7337a2793c Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 25 Mar 2021 14:39:37 +0100 Subject: [PATCH] paytest: Reproduce crash reported by m-schmoock on direct payment We crash the plugin accidentally if we're not handling a paytest but rather a payment destined for us, due to us falsely assuming the short-channel-id to be set in the onion Reported-by: Michael Schmoock <@m-schmoock> --- paytest/test_paytest.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/paytest/test_paytest.py b/paytest/test_paytest.py index 6cf5866..3e8ae4f 100644 --- a/paytest/test_paytest.py +++ b/paytest/test_paytest.py @@ -43,9 +43,6 @@ def test_mpp_pay(node_factory): l1, l2 = node_factory.line_graph(2, opts=pluginopt, wait_for_announce=True) res = l1.rpc.paytest(l2.info['id'], 10**8) - from pprint import pprint - #pprint(res) - l2.daemon.wait_for_log(r'Received 100000000/100000000 with [0-9]+ parts') parts = res['status']['attempts'] @@ -58,3 +55,18 @@ def test_mpp_pay(node_factory): is16399 = [p == 16399 for p in outcomes] assert all(is16399) assert len(is16399) >= 1 + + +@pytest.mark.xfail(strict=True) +def test_incoming_payment(node_factory): + """Ensure that we don't fail if the payment is not a paytest. + """ + l1, l2 = node_factory.line_graph(2, opts=pluginopt, wait_for_announce=True) + inv = l2.rpc.invoice(42, 'lbl', 'desc')['bolt11'] + l1.rpc.pay(inv) + + plugins = [p['name'] for p in l2.rpc.listconfigs()['plugins']] + assert 'paytest.py' in plugins + + plugins = [p['name'] for p in l1.rpc.listconfigs()['plugins']] + assert 'paytest.py' in plugins