@@ -481,6 +481,29 @@ def test_xpay_takeover(node_factory, executor):
481
481
l1 .daemon .wait_for_log ('Converted maxfeepercent=0.25, exemptfee=UNSET to maxfee 5000msat' )
482
482
483
483
484
+ def test_xpay_takeover_null_parms (node_factory , executor ):
485
+ """Test passing through RPC a list of parameters some of which have null
486
+ json value."""
487
+ l1 , l2 , l3 = node_factory .line_graph (
488
+ 3 , wait_for_announce = True , opts = {"xpay-handle-pay" : True }
489
+ )
490
+
491
+ # Amount argument is null.
492
+ inv = l3 .rpc .invoice (100000 , "test_xpay_takeover1" , "test_xpay_takeover1" )["bolt11" ]
493
+ l1 .rpc .call ("pay" , [inv , None ])
494
+ l1 .daemon .wait_for_log ("Redirecting pay->xpay" )
495
+
496
+ # Amount argument is given
497
+ inv = l3 .rpc .invoice ("any" , "test_xpay_takeover2" , "test_xpay_takeover2" )["bolt11" ]
498
+ l1 .rpc .call ("pay" , [inv , "100sat" ])
499
+ l1 .daemon .wait_for_log ("Redirecting pay->xpay" )
500
+
501
+ # bolt11 invoice cannot be NULL
502
+ with pytest .raises (RpcError , match = r"missing required parameter: bolt11" ):
503
+ l1 .rpc .call ("pay" , [None , "100sat" ])
504
+ l1 .daemon .wait_for_log (r"Not redirecting pay \(missing bolt11 parameter\)" )
505
+
506
+
484
507
def test_xpay_preapprove (node_factory ):
485
508
l1 , l2 = node_factory .line_graph (2 , opts = {'dev-hsmd-fail-preapprove' : None })
486
509
0 commit comments