Skip to content

Commit 3f2b490

Browse files
Lagrang3endothermicdev
authored andcommitted
xpay-handle-pay: test null params
Changelog-None: xpay-handle-pay: test null params in json array. Signed-off-by: Lagrang3 <[email protected]>
1 parent 21195be commit 3f2b490

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/test_xpay.py

+23
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,29 @@ def test_xpay_takeover(node_factory, executor):
481481
l1.daemon.wait_for_log('Converted maxfeepercent=0.25, exemptfee=UNSET to maxfee 5000msat')
482482

483483

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+
484507
def test_xpay_preapprove(node_factory):
485508
l1, l2 = node_factory.line_graph(2, opts={'dev-hsmd-fail-preapprove': None})
486509

0 commit comments

Comments
 (0)