Skip to content

Commit 7c9fb7e

Browse files
Lagrang3sangbida
authored andcommitted
xpay: handle pay ignoring unknown arguments
Changelog-Fixed: xpay: handle payment redirected from "pay" even if we don't recognize some arguments. Signed-off-by: Lagrang3 <lagrang3@protonmail.com>
1 parent 6fa4d32 commit 7c9fb7e

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

plugins/xpay/xpay.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,10 +2457,9 @@ static struct command_result *handle_rpc_command(struct command *cmd,
24572457
maxdelay = t + 1;
24582458
else {
24592459
plugin_log(cmd->plugin, LOG_INFORM,
2460-
"Not redirecting pay (unknown arg %.*s)",
2460+
"Unknown arg %.*s, xpay will ignore it.",
24612461
json_tok_full_len(t),
24622462
json_tok_full(buf, t));
2463-
goto dont_redirect;
24642463
}
24652464
}
24662465
} else {

tests/test_xpay.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,14 +450,16 @@ def test_xpay_takeover(node_factory, executor):
450450
inv, "10000", 'label'])
451451
l1.daemon.wait_for_log(r'Not redirecting pay \(only handle 1 or 2 args\): ')
452452

453-
# Other args fail.
453+
# Other args are ignored.
454454
inv = l3.rpc.invoice('any', "test_xpay_takeover7", "test_xpay_takeover7")
455455
l1.rpc.pay(inv['bolt11'], amount_msat=10000, label='test_xpay_takeover7')
456-
l1.daemon.wait_for_log(r'Not redirecting pay \(unknown arg "label"\)')
456+
l1.daemon.wait_for_log('Unknown arg "label", xpay will ignore it.')
457+
l1.daemon.wait_for_log('Redirecting pay->xpay')
457458

458459
inv = l3.rpc.invoice('any', "test_xpay_takeover8", "test_xpay_takeover8")
459460
l1.rpc.pay(inv['bolt11'], amount_msat=10000, riskfactor=1)
460-
l1.daemon.wait_for_log(r'Not redirecting pay \(unknown arg "riskfactor"\)')
461+
l1.daemon.wait_for_log('Unknown arg "riskfactor", xpay will ignore it.')
462+
l1.daemon.wait_for_log('Redirecting pay->xpay')
461463

462464
# Test that it's really dynamic.
463465
l1.rpc.setconfig('xpay-handle-pay', False)

0 commit comments

Comments
 (0)