From a9b992a94a047c2e8cc7e06ba1c75aede289ee06 Mon Sep 17 00:00:00 2001 From: ZmnSCPxj jxPCSnmZ Date: Thu, 6 Aug 2020 12:49:25 +0800 Subject: [PATCH] tests/test_pay.py: Add test for conflict between presplit and routehints paymods. --- tests/test_pay.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/test_pay.py b/tests/test_pay.py index 8d22f86589b4..3dca2ac3d7a8 100644 --- a/tests/test_pay.py +++ b/tests/test_pay.py @@ -3221,3 +3221,32 @@ def test_bolt11_null_after_pay(node_factory, bitcoind): pays = l2.rpc.listpays()["pays"] assert(pays[0]["bolt11"] == invl1) assert('amount_msat' in pays[0] and pays[0]['amount_msat'] == amt) + + +@pytest.mark.xfail(strict=True) +def test_mpp_presplit_routehint_conflict(node_factory, bitcoind): + ''' + We have a bug where pre-splitting the payment prevents *any* + routehints from being taken. + We tickle that bug here by building l1->l2->l3, but with + l2->l3 as an unpublished channel. + If the payment is large enough to trigger pre-splitting, the + routehints are not applied in any of the splits. + ''' + l1, l2, l3 = node_factory.get_nodes(3) + + l1.rpc.connect(l2.info['id'], 'localhost', l2.port) + l1l2 = l1.fund_channel(l2, 10**7, announce_channel=True) + l2.rpc.connect(l3.info['id'], 'localhost', l3.port) + l2.fund_channel(l3, 10**7, announce_channel=False) + + bitcoind.generate_block(6) + sync_blockheight(bitcoind, [l1, l2, l3]) + + # Wait for l3 to learn about l1->l2, otherwise it will think + # l2 is a deadend and not add it to the routehint. + wait_for(lambda: len(l3.rpc.listchannels(l1l2)['channels']) >= 2) + + inv = l3.rpc.invoice(Millisatoshi(2 * 10000 * 1000), 'i', 'i', exposeprivatechannels=True)['bolt11'] + + l1.rpc.pay(inv)