diff --git a/doc/developers-guide/deprecations.md b/doc/developers-guide/deprecations.md index 68b7fccea..f09469309 100644 --- a/doc/developers-guide/deprecations.md +++ b/doc/developers-guide/deprecations.md @@ -7,10 +7,6 @@ hidden: false | Name | Type | First Deprecated | Last Supported | Description | |--------------------------------------|--------------------|------------------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| rest-port.clnrest-prefix | Config | v23.11 | v24.11 | Autodetect where we need to rename `rest-port` to `clnrest-port` (added in v23.11) | -| rest-protocol.clnrest-prefix | Config | v23.11 | v24.11 | Autodetect where we need to rename `rest-protocol` to `clnrest-protocol` (added in v23.11) | -| rest-host.clnrest-prefix | Config | v23.11 | v24.11 | Autodetect where we need to rename `rest-host` to `clnrest-host` (added in v23.11) | -| rest-certs.clnrest-prefix | Config | v23.11 | v24.11 | Autodetect where we need to rename `rest-certs` to `clnrest-certs` (added in v23.11) | | commando-rune | Command | v23.08 | v25.02 | replaced with `lightning-createrune` | | commando-listrunes | Command | v23.08 | v25.02 | replaced with `lightning-showrunes` | | commando-blacklist | Command | v23.08 | v25.02 | replaced with `lightning-blacklistrune` | diff --git a/lightningd/options.c b/lightningd/options.c index e97a52212..b5fd419bb 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -1833,48 +1833,8 @@ void handle_early_opts(struct lightningd *ld, int argc, char *argv[]) logging_options_parsed(ld->log_book); } -/* Free *str, set *str to copy with `cln` prepended */ -static void prefix_cln(char **str STEALS) -{ - char *newstr = tal_fmt(tal_parent(*str), "cln%s", *str); - tal_free(*str); - *str = newstr; -} - -/* Due to a conflict between the widely-deployed clightning-rest plugin and - * our own clnrest plugin, and people wanting to run both, in v23.11 we - * renamed some options. This breaks perfectly working v23.08 deployments who - * don't care about clightning-rest, so we work around it here. */ -static void fixup_clnrest_options(struct lightningd *ld) -{ - for (size_t i = 0; i < tal_count(ld->configvars); i++) { - struct configvar *cv = ld->configvars[i]; - - /* These worked for v23.08 */ - if (!strstarts(cv->configline, "rest-port=") - && !strstarts(cv->configline, "rest-protocol=") - && !strstarts(cv->configline, "rest-host=") - && !strstarts(cv->configline, "rest-certs=")) - continue; - /* Did some (plugin) claim it? */ - if (opt_find_long(cv->configline, cast_const2(const char **, &cv->optarg))) - continue; - if (!opt_deprecated_ok(ld, - tal_strndup(tmpctx, cv->configline, - strcspn(cv->configline, "=")), - "clnrest-prefix", - "v23.11", "v24.11")) - continue; - log_unusual(ld->log, "Option %s deprecated in v23.11, renaming to cln%s", - cv->configline, cv->configline); - prefix_cln(&cv->configline); - } -} - void handle_opts(struct lightningd *ld) { - fixup_clnrest_options(ld); - /* Now we know all the options, finish parsing and finish * populating ld->configvars with cmdline. */ parse_configvars_final(ld->configvars, true, ld->developer); diff --git a/tests/test_clnrest.py b/tests/test_clnrest.py index f38f8555e..ea2f65ba3 100644 --- a/tests/test_clnrest.py +++ b/tests/test_clnrest.py @@ -1,7 +1,6 @@ from fixtures import * # noqa: F401,F403 from pyln.testing.utils import TEST_NETWORK, wait_for from pyln.client import Millisatoshi -import os import requests from pathlib import Path from requests.adapters import HTTPAdapter @@ -469,43 +468,6 @@ def test_http_headers(node_factory): assert response.headers['Access-Control-Allow-Origin'] == 'http://192.168.1.10:1010' -def test_old_params(node_factory): - """Test that we handle the v23.08-style parameters""" - rest_port = str(node_factory.get_unused_port()) - rest_host = '127.0.0.1' - base_url = f'https://{rest_host}:{rest_port}' - l1 = node_factory.get_node(options={'rest-port': rest_port, - 'rest-host': rest_host, - 'allow-deprecated-apis': True, - 'i-promise-to-fix-broken-api-user': ['rest-port.clnrest-prefix', 'rest-host.clnrest-prefix']}, - broken_log=r'DEPRECATED API USED rest-*') - - # This might happen really early! - l1.daemon.logsearch_start = 0 - l1.daemon.wait_for_logs([r'UNUSUAL lightningd: Option rest-port=.* deprecated in v23\.11, renaming to clnrest-port', - r'UNUSUAL lightningd: Option rest-host=.* deprecated in v23\.11, renaming to clnrest-host']) - l1.daemon.wait_for_log(r'plugin-clnrest: REST server running at ' + base_url) - - # Now try one where a plugin (e.g. clightning-rest) registers the option. - plugin = os.path.join(os.path.dirname(__file__), 'plugins/clnrest-use-options.py') - l2 = node_factory.get_node(options={'rest-port': rest_port, - 'rest-host': rest_host, - 'plugin': plugin, - 'allow-deprecated-apis': True, - 'i-promise-to-fix-broken-api-user': ['rest-port.clnrest-prefix', 'rest-host.clnrest-prefix']}, - broken_log=r'DEPRECATED API USED rest-*') - - l2.daemon.logsearch_start = 0 - # We still rename this one, since it's for clnrest. - assert l2.daemon.is_in_log(r'UNUSUAL lightningd: Option rest-host=.* deprecated in v23\.11, renaming to clnrest-host') - - # This one does not get renamed! - assert not l2.daemon.is_in_log(r'UNUSUAL lightningd: Option rest-port=.* deprecated in v23\.11, renaming to clnrest-host') - assert [p for p in l2.rpc.plugin('list')['plugins'] if p['name'].endswith('clnrest')] == [] - assert l2.daemon.is_in_log(r'plugin-clnrest: Killing plugin: disabled itself at init: `clnrest-port` option is not configured') - assert l2.daemon.is_in_log(rf'clnrest-use-options.py: rest-port is {rest_port}') - - def test_websocket_upgrade_header(node_factory): """Test that not setting an upgrade header leads to rejection""" # start a node with clnrest