diff --git a/contrib/msggen/msggen/schema.json b/contrib/msggen/msggen/schema.json index 8f83713d92be..65d9964af1dd 100644 --- a/contrib/msggen/msggen/schema.json +++ b/contrib/msggen/msggen/schema.json @@ -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, diff --git a/doc/developers-guide/deprecated-features.md b/doc/developers-guide/deprecated-features.md index 470fef6f88d9..220d0b742a89 100644 --- a/doc/developers-guide/deprecated-features.md +++ b/doc/developers-guide/deprecated-features.md @@ -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. diff --git a/doc/schemas/listconfigs.json b/doc/schemas/listconfigs.json index 2fa9ba4b9b75..eff813e4a99e 100644 --- a/doc/schemas/listconfigs.json +++ b/doc/schemas/listconfigs.json @@ -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, diff --git a/plugins/libplugin.c b/plugins/libplugin.c index 2bc153f6e8f9..bcd2509eb189 100644 --- a/plugins/libplugin.c +++ b/plugins/libplugin.c @@ -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; diff --git a/plugins/libplugin.h b/plugins/libplugin.h index 9134d2a28075..789a1542c64e 100644 --- a/plugins/libplugin.h +++ b/plugins/libplugin.h @@ -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) diff --git a/plugins/xpay/xpay.c b/plugins/xpay/xpay.c index 7cf2c2061ccc..46bfd33c08be 100644 --- a/plugins/xpay/xpay.c +++ b/plugins/xpay/xpay.c @@ -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), diff --git a/tests/test_xpay.py b/tests/test_xpay.py index 4c4cec3f848a..99ebc9776af3 100644 --- a/tests/test_xpay.py +++ b/tests/test_xpay.py @@ -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.