Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion contrib/msggen/msggen/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -21894,7 +21894,11 @@
"value_bool": false,
"source": "default",
"plugin": "/root/lightning/plugins/cln-xpay",
"dynamic": true
"dynamic": true,
"deprecated": [
"v26.09",
"v27.03"
]
},
"xpay-slow-mode": {
"value_bool": false,
Expand Down
1 change: 1 addition & 0 deletions doc/developers-guide/deprecated-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ privacy:
| keysend | Command | v26.06 | v27.03 | Replaced by more powerful `xkeysend`. |
| renepay | Command | v26.06 | v27.03 | Use `xpay` instead. |
| renepaystatus | Command | v26.06 | v27.03 | Use `xpay` notifications and `listpays` or `listsendpays` instead. |
| xpay-handle-pay | Config | v26.09 | v27.03 | `pay` is being deprecated and `xpay` for all payments is the default. |

Inevitably there are features which need to change: either to be generalized, or removed when they can no longer be supported.

Expand Down
6 changes: 5 additions & 1 deletion doc/schemas/listconfigs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2191,7 +2191,11 @@
"value_bool": false,
"source": "default",
"plugin": "/root/lightning/plugins/cln-xpay",
"dynamic": true
"dynamic": true,
"deprecated": [
"v26.09",
"v27.03"
]
},
"xpay-slow-mode": {
"value_bool": false,
Expand Down
26 changes: 18 additions & 8 deletions plugins/libplugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -2244,15 +2244,25 @@ static void ld_command_handle(struct plugin *plugin,
else
val = "true";

problem = popt->handle(cmd, val, check_only, popt->arg);
if (problem)
if (!deprecated_ok(plugin->deprecated_ok, popt->name,
popt->depr_start, popt->depr_end,
plugin->beglist, NULL, NULL)) {
ret = command_fail(cmd, JSONRPC2_INVALID_PARAMS,
"%s", problem);
else {
if (check_only)
ret = command_check_done(cmd);
else
ret = command_finished(cmd, jsonrpc_stream_success(cmd));
"Configuration %s is deprecated",
popt->name);
} else {

problem = popt->handle(cmd, val, check_only, popt->arg);
if (problem)
ret = command_fail(cmd, JSONRPC2_INVALID_PARAMS,
"%s", problem);
else {
if (check_only)
ret = command_check_done(cmd);
else
ret = command_finished(
cmd, jsonrpc_stream_success(cmd));
}
}
assert(ret == &complete);
return;
Expand Down
3 changes: 3 additions & 0 deletions plugins/libplugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,9 @@ void *plugin_get_data_(struct plugin *plugin);
#define plugin_option_deprecated(name, type, description, depr_start, depr_end, set, jsonfmt, arg) \
plugin_option_((name), (type), (description), (set), (jsonfmt), (arg), false, (depr_start), (depr_end), false, false)

#define plugin_option_deprecated_dynamic(name, type, description, depr_start, depr_end, set, jsonfmt, arg) \
plugin_option_((name), (type), (description), (set), (jsonfmt), (arg), false, (depr_start), (depr_end), true, false)

#define plugin_option_multi(name, type, description, set, jsonfmt, arg) \
plugin_option_((name), (type), (description), (set), (jsonfmt), (arg), false, NULL, NULL, false, true)

Expand Down
11 changes: 8 additions & 3 deletions plugins/xpay/xpay.c
Original file line number Diff line number Diff line change
Expand Up @@ -3415,9 +3415,14 @@ int main(int argc, char *argv[])
notifications, ARRAY_SIZE(notifications),
hooks, ARRAY_SIZE(hooks),
outgoing_notifications, ARRAY_SIZE(outgoing_notifications),
plugin_option_dynamic("xpay-handle-pay", "bool",
"Make xpay take over pay commands it can handle.",
bool_option, bool_jsonfmt, &xpay->take_over_pay),
plugin_option_deprecated_dynamic("xpay-handle-pay",
"bool",
"Make xpay take over pay commands it can handle.",
"v26.09",
"v27.03",
bool_option,
NULL,
&xpay->take_over_pay),
plugin_option_dynamic("xpay-slow-mode", "bool",
"Wait until all parts have completed before returning success or failure",
bool_option, bool_jsonfmt, &xpay->slow_mode),
Expand Down
3 changes: 2 additions & 1 deletion tests/test_xpay.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,8 @@ def test_xpay_takeover_null_parms(node_factory, executor):
"""Test passing through RPC a list of parameters some of which have null
json value."""
l1, l2, l3 = node_factory.line_graph(
3, wait_for_announce=True, opts={"xpay-handle-pay": True}
3, wait_for_announce=True, opts={"xpay-handle-pay": True,
"allow-deprecated-apis": True}
)

# Amount argument is null.
Expand Down
Loading