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

Function test_getroutes_single_path

tests/test_askrene.py:852–934  ·  view source on GitHub ↗

Test getroutes generating single path payments

(node_factory)

Source from the content-addressed store, hash-verified

850
851
852def test_getroutes_single_path(node_factory):
853 """Test getroutes generating single path payments"""
854 gsfile, nodemap = generate_gossip_store(
855 [
856 GenChannel(0, 1),
857 GenChannel(1, 2, capacity_sats=9000),
858 GenChannel(1, 2, capacity_sats=10000),
859 ]
860 )
861 # Set up l1 with this as the gossip_store
862 l1 = node_factory.get_node(gossip_store_file=gsfile.name)
863
864 # To be able to route this amount two parts are needed, therefore a single
865 # pay search will fail.
866 # FIXME: the explanation for the failure is wrong
867 with pytest.raises(RpcError):
868 l1.rpc.getroutes(
869 source=nodemap[1],
870 destination=nodemap[2],
871 amount_msat=10000001,
872 layers=[],
873 maxparts=1,
874 maxfee_msat=1000,
875 final_cltv=99,
876 )
877
878 # For this amount, only one solution is possible
879 check_getroute_paths(
880 l1,
881 nodemap[1],
882 nodemap[2],
883 10000000,
884 [
885 [
886 {
887 "short_channel_id_dir": "3x2x2/1",
888 "node_id_out": nodemap[2],
889 "amount_in_msat": 10000010,
890 "cltv_in": 99 + 6,
891 }
892 ]
893 ],
894 maxparts=1,
895 )
896
897 # To be able to route this amount two parts are needed, therefore a single
898 # pay search will fail.
899 # FIXME: the explanation for the failure is wrong
900 with pytest.raises(RpcError):
901 l1.rpc.getroutes(
902 source=nodemap[0],
903 destination=nodemap[2],
904 amount_msat=10000001,
905 layers=[],
906 maxparts=1,
907 maxfee_msat=1000,
908 final_cltv=99,
909 )

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