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

Function test_getroutes_single_path

tests/test_askrene.py:899–981  ·  view source on GitHub ↗

Test getroutes generating single path payments

(node_factory)

Source from the content-addressed store, hash-verified

897
898
899def test_getroutes_single_path(node_factory):
900 """Test getroutes generating single path payments"""
901 gsfile, nodemap = generate_gossip_store(
902 [
903 GenChannel(0, 1),
904 GenChannel(1, 2, capacity_sats=9000),
905 GenChannel(1, 2, capacity_sats=10000),
906 ]
907 )
908 # Set up l1 with this as the gossip_store
909 l1 = node_factory.get_node(gossip_store_file=gsfile.name)
910
911 # To be able to route this amount two parts are needed, therefore a single
912 # pay search will fail.
913 # FIXME: the explanation for the failure is wrong
914 with pytest.raises(RpcError):
915 l1.rpc.getroutes(
916 source=nodemap[1],
917 destination=nodemap[2],
918 amount_msat=10000001,
919 layers=[],
920 maxparts=1,
921 maxfee_msat=1000,
922 final_cltv=99,
923 )
924
925 # For this amount, only one solution is possible
926 check_getroute_paths(
927 l1,
928 nodemap[1],
929 nodemap[2],
930 10000000,
931 [
932 [
933 {
934 "short_channel_id_dir": "3x2x2/1",
935 "node_id_out": nodemap[2],
936 "amount_in_msat": 10000010,
937 "cltv_in": 99 + 6,
938 }
939 ]
940 ],
941 maxparts=1,
942 )
943
944 # To be able to route this amount two parts are needed, therefore a single
945 # pay search will fail.
946 # FIXME: the explanation for the failure is wrong
947 with pytest.raises(RpcError):
948 l1.rpc.getroutes(
949 source=nodemap[0],
950 destination=nodemap[2],
951 amount_msat=10000001,
952 layers=[],
953 maxparts=1,
954 maxfee_msat=1000,
955 final_cltv=99,
956 )

Callers

nothing calls this directly

Calls 5

generate_gossip_storeFunction · 0.90
GenChannelClass · 0.90
check_getroute_pathsFunction · 0.85
getroutesMethod · 0.80
get_nodeMethod · 0.45

Tested by

no test coverage detected