@@ -1011,3 +1011,28 @@ def test_xpay_bip353(node_factory):
10111011
10121012 node_factory .join_nodes ([l2 , l1 ])
10131013 l2 .
rpc .
xpay (
'[email protected] ' ,
100 )
1014+
1015+
1016+ @pytest .mark .xfail (strict = True )
1017+ def test_xpay_limited_max_accepted_htlcs (node_factory ):
1018+ """xpay should try to reduce flows to 6 if there is an unannounced channel, and only try more if that fails"""
1019+ CHANNEL_SIZE_SATS = 10 ** 6
1020+ CHANNEL_SIZE_MSATS = CHANNEL_SIZE_SATS * 1000
1021+ l1 , l2 = node_factory .line_graph (2 ,
1022+ fundamount = CHANNEL_SIZE_SATS * 20 ,
1023+ opts = [{}, {'max-concurrent-htlcs' : 6 }],
1024+ announce_channels = False )
1025+
1026+ # We want 10 paths between l3 and l1.
1027+ l3 = node_factory .get_node ()
1028+ nodes = node_factory .get_nodes (10 )
1029+ for n in nodes :
1030+ node_factory .join_nodes ([l3 , n , l1 ], fundamount = CHANNEL_SIZE_SATS )
1031+
1032+ # This *could* fit in 6 channels...
1033+ l3 .rpc .xpay (l2 .rpc .invoice (f"{ CHANNEL_SIZE_SATS * 5 } sat" ,
1034+ 'test_xpay_limited_max_accepted_htlcs' ,
1035+ 'test_xpay_limited_max_accepted_htlcs' )['bolt11' ])
1036+
1037+ # Check that it *did* give a 7 flow answer!
1038+ l3 .daemon .wait_for_log ('Final answer has 7 flows' )
0 commit comments