MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_impossible_payment

Function test_impossible_payment

tests/test_askrene.py:2681–2751  ·  view source on GitHub ↗

A payment that is impossible due to HTLC constraints and fees. The constraint might cause a timeout in in askrene's main loop due to the refine step.

(node_factory)

Source from the content-addressed store, hash-verified

2679
2680
2681def test_impossible_payment(node_factory):
2682 """A payment that is impossible due to HTLC constraints and fees. The
2683 constraint might cause a timeout in in askrene's main loop due to the refine
2684 step."""
2685 l1 = node_factory.get_node()
2686 node1 = "020000000000000000000000000000000000000000000000000000000000000001"
2687 node2 = "020000000000000000000000000000000000000000000000000000000000000002"
2688 node3 = "020000000000000000000000000000000000000000000000000000000000000003"
2689 million_sats = 1000000000
2690 pay_amt = 10000000
2691 base_amt = int(pay_amt * 1.1)
2692 l1.rpc.askrene_create_layer("mylayer")
2693 l1.rpc.askrene_create_channel(
2694 layer="mylayer",
2695 source=node1,
2696 destination=node2,
2697 short_channel_id="0x0x1",
2698 capacity_msat=million_sats,
2699 )
2700 l1.rpc.askrene_update_channel(
2701 layer="mylayer",
2702 short_channel_id_dir="0x0x1/0",
2703 enabled=True,
2704 htlc_minimum_msat=0,
2705 htlc_maximum_msat=base_amt,
2706 fee_base_msat=0,
2707 fee_proportional_millionths=0,
2708 cltv_expiry_delta=18,
2709 )
2710 l1.rpc.askrene_create_channel(
2711 layer="mylayer",
2712 source=node2,
2713 destination=node3,
2714 short_channel_id="0x0x2",
2715 capacity_msat=million_sats,
2716 )
2717 l1.rpc.askrene_update_channel(
2718 layer="mylayer",
2719 short_channel_id_dir="0x0x2/0",
2720 enabled=True,
2721 htlc_minimum_msat=0,
2722 htlc_maximum_msat=million_sats,
2723 fee_base_msat=base_amt,
2724 fee_proportional_millionths=0,
2725 cltv_expiry_delta=18,
2726 )
2727 with pytest.raises(
2728 RpcError,
2729 match=r"We could not find a usable set of paths. The shortest path is 0x0x1->0x0x2, but 0x0x1/0 exceeds htlc_maximum_msat",
2730 ):
2731 l1.rpc.getroutes(
2732 source=node1,
2733 destination=node3,
2734 amount_msat=pay_amt,
2735 layers=["mylayer"],
2736 maxfee_msat=2 * pay_amt,
2737 final_cltv=5,
2738 )

Callers

nothing calls this directly

Calls 2

getroutesMethod · 0.80
get_nodeMethod · 0.45

Tested by

no test coverage detected