@@ -568,25 +568,88 @@ def test_getroutes(node_factory):
568568 'amount_msat' : 5500005 ,
569569 'delay' : 99 + 6 }]])
570570
571- # We realize that this is impossible in a single path:
572- with pytest .raises (RpcError , match = "The shortest path is 0x2x1, but 0x2x1/1 marked disabled by layer auto.no_mpp_support." ):
573- l1 .rpc .getroutes (source = nodemap [0 ],
574- destination = nodemap [2 ],
575- amount_msat = 10000000 ,
576- layers = ['auto.no_mpp_support' ],
577- maxfee_msat = 1000 ,
578- final_cltv = 99 )
579571
580- # But this will work.
581- check_getroute_paths (l1 ,
582- nodemap [0 ],
583- nodemap [2 ],
584- 9000000 ,
585- [[{'short_channel_id_dir' : '0x2x3/1' ,
586- 'next_node_id' : nodemap [2 ],
587- 'amount_msat' : 9000009 ,
588- 'delay' : 99 + 6 }]],
589- layers = ['auto.no_mpp_support' ])
572+ def test_getroutes_single_path (node_factory ):
573+ """Test getroutes generating single path payments"""
574+ gsfile , nodemap = generate_gossip_store (
575+ [
576+ GenChannel (0 , 1 ),
577+ GenChannel (1 , 2 , capacity_sats = 9000 ),
578+ GenChannel (1 , 2 , capacity_sats = 10000 ),
579+ ]
580+ )
581+ # Set up l1 with this as the gossip_store
582+ l1 = node_factory .get_node (gossip_store_file = gsfile .name )
583+
584+ # To be able to route this amount two parts are needed, therefore a single
585+ # pay search will fail.
586+ # FIXME: the explanation for the failure is wrong
587+ with pytest .raises (RpcError ):
588+ l1 .rpc .getroutes (
589+ source = nodemap [1 ],
590+ destination = nodemap [2 ],
591+ amount_msat = 10000001 ,
592+ layers = ["auto.no_mpp_support" ],
593+ maxfee_msat = 1000 ,
594+ final_cltv = 99 ,
595+ )
596+
597+ # For this amount, only one solution is possible
598+ check_getroute_paths (
599+ l1 ,
600+ nodemap [1 ],
601+ nodemap [2 ],
602+ 10000000 ,
603+ [
604+ [
605+ {
606+ "short_channel_id_dir" : "1x2x2/1" ,
607+ "next_node_id" : nodemap [2 ],
608+ "amount_msat" : 10000010 ,
609+ "delay" : 99 + 6 ,
610+ }
611+ ]
612+ ],
613+ layers = ["auto.no_mpp_support" ],
614+ )
615+
616+ # To be able to route this amount two parts are needed, therefore a single
617+ # pay search will fail.
618+ # FIXME: the explanation for the failure is wrong
619+ with pytest .raises (RpcError ):
620+ l1 .rpc .getroutes (
621+ source = nodemap [0 ],
622+ destination = nodemap [2 ],
623+ amount_msat = 10000001 ,
624+ layers = ["auto.no_mpp_support" ],
625+ maxfee_msat = 1000 ,
626+ final_cltv = 99 ,
627+ )
628+
629+ # For this amount, only one solution is possible
630+ check_getroute_paths (
631+ l1 ,
632+ nodemap [0 ],
633+ nodemap [2 ],
634+ 10000000 ,
635+ [
636+ [
637+ {
638+ "short_channel_id_dir" : "0x1x0/1" ,
639+ "next_node_id" : nodemap [1 ],
640+ "amount_msat" : 10000020 ,
641+ "delay" : 99 + 6 + 6 ,
642+ },
643+ {
644+ "short_channel_id_dir" : "1x2x2/1" ,
645+ "next_node_id" : nodemap [2 ],
646+ "amount_msat" : 10000010 ,
647+ "delay" : 99 + 6 ,
648+ },
649+ ]
650+ ],
651+ layers = ["auto.no_mpp_support" ],
652+ )
590653
591654
592655def test_getroutes_fee_fallback (node_factory ):
0 commit comments