2424@pytest .mark .openchannel ('v1' )
2525@pytest .mark .openchannel ('v2' )
2626def test_pay (node_factory ):
27- l1 , l2 = node_factory .line_graph (2 )
27+ l1 , l2 = node_factory .line_graph (2 , opts = {"allow-deprecated-apis" : True ,
28+ "xpay-handle-pay" : False })
2829
2930 inv = l2 .rpc .invoice (123000 , 'test_pay' , 'description' )['bolt11' ]
3031 before = int (time .time ())
@@ -84,8 +85,10 @@ def test_pay(node_factory):
8485 assert apys_1 [0 ]['routed_in_msat' ] == apys_2 [0 ]['routed_out_msat' ]
8586
8687
87- def test_pay_invstring (node_factory ):
88- l1 , l2 = node_factory .line_graph (2 , opts = {'allow-deprecated-apis' : True })
88+ @pytest .mark .parametrize ("xpay_handle_pay" , [True , False ])
89+ def test_pay_invstring (node_factory , xpay_handle_pay ):
90+ l1 , l2 = node_factory .line_graph (2 , opts = {'allow-deprecated-apis' : True ,
91+ "xpay-handle-pay" : xpay_handle_pay })
8992
9093 l1 .rpc .check_request_schemas = False
9194 inv = l2 .rpc .invoice (123000 , 'test_pay_invstring' , 'description' )['bolt11' ]
@@ -2381,7 +2384,8 @@ def test_setchannel_routing(node_factory, bitcoind):
23812384 assert 'warning_capacity' in inv
23822385
23832386
2384- def test_setchannel_zero (node_factory , bitcoind ):
2387+ @pytest .mark .parametrize ("xpay_handle_pay" , [True , False ])
2388+ def test_setchannel_zero (node_factory , bitcoind , xpay_handle_pay ):
23852389 # TEST SETUP
23862390 #
23872391 # [l1] <--default_fees--> [l2] <--specific_fees--> [l3]
@@ -2395,7 +2399,8 @@ def test_setchannel_zero(node_factory, bitcoind):
23952399
23962400 l1 , l2 , l3 = node_factory .line_graph (
23972401 3 , announce_channels = True , wait_for_announce = True ,
2398- opts = {'fee-base' : DEF_BASE , 'fee-per-satoshi' : DEF_PPM })
2402+ opts = {'fee-base' : DEF_BASE , 'fee-per-satoshi' : DEF_PPM ,
2403+ "allow-deprecated-apis" : True , "xpay-handle-pay" : xpay_handle_pay })
23992404
24002405 # get short channel id for 2->3
24012406 scid = l2 .get_channel_scid (l3 )
@@ -3428,13 +3433,16 @@ def test_reject_invalid_payload(node_factory):
34283433 l2 .daemon .wait_for_log (r'Failing HTLC because of an invalid payload' )
34293434
34303435
3431- def test_excluded_adjacent_routehint (node_factory , bitcoind ):
3436+ @pytest .mark .parametrize ("xpay_handle_pay" , [True , False ])
3437+ def test_excluded_adjacent_routehint (node_factory , bitcoind , xpay_handle_pay ):
34323438 """Test case where we try have a routehint which leads to an adjacent
34333439 node, but the result exceeds our maxfee; we crashed trying to find
34343440 what part of the path was most expensive in that case
34353441
34363442 """
3437- l1 , l2 , l3 = node_factory .line_graph (3 )
3443+ l1 , l2 , l3 = node_factory .line_graph (3 , opts = {"allow-deprecated-apis" : True ,
3444+ "xpay-handle-pay" :
3445+ xpay_handle_pay })
34383446
34393447 # Make sure l2->l3 is usable.
34403448 wait_for (lambda : 'remote' in only_one (l3 .rpc .listpeerchannels ()['channels' ])['updates' ])
@@ -3446,7 +3454,10 @@ def test_excluded_adjacent_routehint(node_factory, bitcoind):
34463454 wait_for (lambda : 'remote' in only_one (l1 .rpc .listpeerchannels ()['channels' ])['updates' ])
34473455
34483456 # This will make it reject the routehint.
3449- err = 'Failed: Could not find route without excessive cost'
3457+ if xpay_handle_pay :
3458+ err = 'Failed: Could not find route without excessive cost'
3459+ else :
3460+ err = 'Fee exceeds our fee budget: 1msat > 0msat'
34503461 with pytest .raises (RpcError , match = err ):
34513462 l1 .rpc .pay (bolt11 = inv ['bolt11' ], maxfeepercent = 0 , exemptfee = 0 )
34523463
@@ -4837,13 +4848,13 @@ def test_recurrence_expired_offer(node_factory, bitcoind):
48374848 ret = l1 .rpc .fetchinvoice (offer = offer ['bolt12' ],
48384849 recurrence_counter = 0 ,
48394850 recurrence_label = 'test_recurrence_expired_offer' )
4840- l1 .rpc .pay (ret ['invoice' ], label = 'test_recurrence_expired_offer' )
4851+ l1 .rpc .xpay (ret ['invoice' ], label = 'test_recurrence_expired_offer' )
48414852
48424853 time .sleep (16 )
48434854 ret = l1 .rpc .fetchinvoice (offer = offer ['bolt12' ],
48444855 recurrence_counter = 1 ,
48454856 recurrence_label = 'test_recurrence_expired_offer' )
4846- l1 .rpc .pay (ret ['invoice' ], label = 'test_recurrence_expired_offer' )
4857+ l1 .rpc .xpay (ret ['invoice' ], label = 'test_recurrence_expired_offer' )
48474858
48484859
48494860def test_fetchinvoice_autoconnect (node_factory , bitcoind ):
@@ -4921,7 +4932,8 @@ def test_fetchinvoice_disconnected_reply(node_factory, bitcoind):
49214932 assert l3 .rpc .listpeers (l1 .info ['id' ]) == {'peers' : []}
49224933
49234934
4924- def test_pay_blockheight_mismatch (node_factory , bitcoind ):
4935+ @pytest .mark .parametrize ("xpay_handle_pay" , [True , False ])
4936+ def test_pay_blockheight_mismatch (node_factory , bitcoind , xpay_handle_pay ):
49254937 """Test that we can send a payment even if not caught up with the chain.
49264938
49274939 We removed the requirement for the node to be fully synced up with
@@ -4935,7 +4947,11 @@ def test_pay_blockheight_mismatch(node_factory, bitcoind):
49354947
49364948 send , direct , recv = node_factory .line_graph (3 ,
49374949 wait_for_announce = True ,
4938- opts = {'may_reconnect' : True })
4950+ opts = {'may_reconnect' : True ,
4951+ "allow-deprecated-apis" :
4952+ True ,
4953+ "xpay-handle-pay" :
4954+ xpay_handle_pay })
49394955 sync_blockheight (bitcoind , [send , recv ])
49404956
49414957 height = bitcoind .rpc .getblockchaininfo ()['blocks' ]
@@ -5611,15 +5627,17 @@ def test_self_sendpay(node_factory):
56115627 l1 .rpc .sendpay ([], inv ['payment_hash' ], label = 'selfpay' , bolt11 = inv ['bolt11' ], payment_secret = inv ['payment_secret' ], amount_msat = '100000sat' )
56125628
56135629
5614- def test_strip_lightning_suffix_from_inv (node_factory ):
5630+ @pytest .mark .parametrize ("xpay_handle_pay" , [True , False ])
5631+ def test_strip_lightning_suffix_from_inv (node_factory , xpay_handle_pay ):
56155632 """
56165633 Reproducer for [1] that pay an invoice with the `lightning:<bolt11|bolt12>`
56175634 prefix and then, will check if core lightning is able to strip it during
56185635 list `listpays` command.
56195636
56205637 [1] https://github.com/ElementsProject/lightning/issues/6207
56215638 """
5622- l1 , l2 = node_factory .line_graph (2 )
5639+ l1 , l2 = node_factory .line_graph (2 , opts = {"allow-deprecated-apis" : True ,
5640+ "xpay-handle-pay" : xpay_handle_pay })
56235641 inv = l2 .rpc .invoice (40 , "strip-lightning-prefix" , "test to be able to strip the `lightning:` prefix." )["bolt11" ]
56245642 wait_for (lambda : only_one (l1 .rpc .listpeerchannels (l2 .info ['id' ])['channels' ])['state' ] == 'CHANNELD_NORMAL' )
56255643
0 commit comments