| 
4 | 4 | from pyln.testing.utils import SLOW_MACHINE  | 
5 | 5 | from utils import (  | 
6 | 6 |     only_one, first_scid, GenChannel, generate_gossip_store,  | 
7 |  | -    sync_blockheight, wait_for, TEST_NETWORK, TIMEOUT  | 
 | 7 | +    sync_blockheight, wait_for, TEST_NETWORK, TIMEOUT, mine_funding_to_announce  | 
8 | 8 | )  | 
9 | 9 | import os  | 
10 | 10 | import pytest  | 
@@ -1536,3 +1536,40 @@ def test_simple_dummy_channel(node_factory):  | 
1536 | 1536 |         final_cltv=5,  | 
1537 | 1537 |         layers=["mylayer"],  | 
1538 | 1538 |     )  | 
 | 1539 | + | 
 | 1540 | + | 
 | 1541 | +@pytest.mark.xfail(strict=True)  | 
 | 1542 | +def test_maxparts_infloop(node_factory, bitcoind):  | 
 | 1543 | +    # Three paths from l1 -> l5.  | 
 | 1544 | +    # FIXME: enhance explain_failure!  | 
 | 1545 | +    l1, l2, l3, l4, l5 = node_factory.get_nodes(5, opts=[{'broken_log': 'plugin-cln-askrene.*the obvious route'}] + [{}] * 4)  | 
 | 1546 | + | 
 | 1547 | +    for intermediate in (l2, l3, l4):  | 
 | 1548 | +        node_factory.join_nodes([l1, intermediate, l5])  | 
 | 1549 | + | 
 | 1550 | +    # We create exorbitant fees into l3.  | 
 | 1551 | +    for n in (l2, l3, l4):  | 
 | 1552 | +        n.rpc.setchannel(l5.info['id'], feeppm=100000)  | 
 | 1553 | + | 
 | 1554 | +    mine_funding_to_announce(bitcoind, (l1, l2, l3, l4, l5))  | 
 | 1555 | +    wait_for(lambda: len(l1.rpc.listchannels()['channels']) == 12)  | 
 | 1556 | + | 
 | 1557 | +    amount=1_400_000_000  | 
 | 1558 | +    # You can do this one  | 
 | 1559 | +    route = l1.rpc.getroutes(source=l1.info['id'],  | 
 | 1560 | +                             destination=l5.info['id'],  | 
 | 1561 | +                             amount_msat=amount,  | 
 | 1562 | +                             layers=[],  | 
 | 1563 | +                             maxfee_msat=amount,  | 
 | 1564 | +                             final_cltv=5)  | 
 | 1565 | +    assert len(route['routes']) == 3  | 
 | 1566 | + | 
 | 1567 | +    # Now with maxparts == 2:  | 
 | 1568 | +    with pytest.raises(RpcError, match="Actually, I'm not sure why we didn't find the obvious route"):  | 
 | 1569 | +        l1.rpc.getroutes(source=l1.info['id'],  | 
 | 1570 | +                         destination=l5.info['id'],  | 
 | 1571 | +                         amount_msat=amount,  | 
 | 1572 | +                         layers=[],  | 
 | 1573 | +                         maxfee_msat=amount,  | 
 | 1574 | +                         final_cltv=5,  | 
 | 1575 | +                         maxparts=2)  | 
0 commit comments