Skip to content

Commit a7d393a

Browse files
committed
lightningd: remove clnrest override options.
Changelog-Removed: Config: autodetection for rest-port/rest-protocol/rest-host/rest-certs options to clnrest-* (deprecated v23.11, disabled v25.02). Signed-off-by: Rusty Russell <[email protected]>
1 parent 4359b73 commit a7d393a

File tree

3 files changed

+0
-81
lines changed

3 files changed

+0
-81
lines changed

doc/developers-guide/deprecations.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ hidden: false
77

88
| Name | Type | First Deprecated | Last Supported | Description |
99
|--------------------------------------|--------------------|------------------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
10-
| rest-port.clnrest-prefix | Config | v23.11 | v24.11 | Autodetect where we need to rename `rest-port` to `clnrest-port` (added in v23.11) |
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) |
12-
| rest-host.clnrest-prefix | Config | v23.11 | v24.11 | Autodetect where we need to rename `rest-host` to `clnrest-host` (added in v23.11) |
13-
| rest-certs.clnrest-prefix | Config | v23.11 | v24.11 | Autodetect where we need to rename `rest-certs` to `clnrest-certs` (added in v23.11) |
1410
| commando-rune | Command | v23.08 | v25.02 | replaced with `lightning-createrune` |
1511
| commando-listrunes | Command | v23.08 | v25.02 | replaced with `lightning-showrunes` |
1612
| commando-blacklist | Command | v23.08 | v25.02 | replaced with `lightning-blacklistrune` |

lightningd/options.c

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,48 +1833,8 @@ void handle_early_opts(struct lightningd *ld, int argc, char *argv[])
18331833
logging_options_parsed(ld->log_book);
18341834
}
18351835

1836-
/* Free *str, set *str to copy with `cln` prepended */
1837-
static void prefix_cln(char **str STEALS)
1838-
{
1839-
char *newstr = tal_fmt(tal_parent(*str), "cln%s", *str);
1840-
tal_free(*str);
1841-
*str = newstr;
1842-
}
1843-
1844-
/* Due to a conflict between the widely-deployed clightning-rest plugin and
1845-
* our own clnrest plugin, and people wanting to run both, in v23.11 we
1846-
* renamed some options. This breaks perfectly working v23.08 deployments who
1847-
* don't care about clightning-rest, so we work around it here. */
1848-
static void fixup_clnrest_options(struct lightningd *ld)
1849-
{
1850-
for (size_t i = 0; i < tal_count(ld->configvars); i++) {
1851-
struct configvar *cv = ld->configvars[i];
1852-
1853-
/* These worked for v23.08 */
1854-
if (!strstarts(cv->configline, "rest-port=")
1855-
&& !strstarts(cv->configline, "rest-protocol=")
1856-
&& !strstarts(cv->configline, "rest-host=")
1857-
&& !strstarts(cv->configline, "rest-certs="))
1858-
continue;
1859-
/* Did some (plugin) claim it? */
1860-
if (opt_find_long(cv->configline, cast_const2(const char **, &cv->optarg)))
1861-
continue;
1862-
if (!opt_deprecated_ok(ld,
1863-
tal_strndup(tmpctx, cv->configline,
1864-
strcspn(cv->configline, "=")),
1865-
"clnrest-prefix",
1866-
"v23.11", "v24.11"))
1867-
continue;
1868-
log_unusual(ld->log, "Option %s deprecated in v23.11, renaming to cln%s",
1869-
cv->configline, cv->configline);
1870-
prefix_cln(&cv->configline);
1871-
}
1872-
}
1873-
18741836
void handle_opts(struct lightningd *ld)
18751837
{
1876-
fixup_clnrest_options(ld);
1877-
18781838
/* Now we know all the options, finish parsing and finish
18791839
* populating ld->configvars with cmdline. */
18801840
parse_configvars_final(ld->configvars, true, ld->developer);

tests/test_clnrest.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -469,43 +469,6 @@ def test_http_headers(node_factory):
469469
assert response.headers['Access-Control-Allow-Origin'] == 'http://192.168.1.10:1010'
470470

471471

472-
def test_old_params(node_factory):
473-
"""Test that we handle the v23.08-style parameters"""
474-
rest_port = str(node_factory.get_unused_port())
475-
rest_host = '127.0.0.1'
476-
base_url = f'https://{rest_host}:{rest_port}'
477-
l1 = node_factory.get_node(options={'rest-port': rest_port,
478-
'rest-host': rest_host,
479-
'allow-deprecated-apis': True,
480-
'i-promise-to-fix-broken-api-user': ['rest-port.clnrest-prefix', 'rest-host.clnrest-prefix']},
481-
broken_log=r'DEPRECATED API USED rest-*')
482-
483-
# This might happen really early!
484-
l1.daemon.logsearch_start = 0
485-
l1.daemon.wait_for_logs([r'UNUSUAL lightningd: Option rest-port=.* deprecated in v23\.11, renaming to clnrest-port',
486-
r'UNUSUAL lightningd: Option rest-host=.* deprecated in v23\.11, renaming to clnrest-host'])
487-
l1.daemon.wait_for_log(r'plugin-clnrest: REST server running at ' + base_url)
488-
489-
# Now try one where a plugin (e.g. clightning-rest) registers the option.
490-
plugin = os.path.join(os.path.dirname(__file__), 'plugins/clnrest-use-options.py')
491-
l2 = node_factory.get_node(options={'rest-port': rest_port,
492-
'rest-host': rest_host,
493-
'plugin': plugin,
494-
'allow-deprecated-apis': True,
495-
'i-promise-to-fix-broken-api-user': ['rest-port.clnrest-prefix', 'rest-host.clnrest-prefix']},
496-
broken_log=r'DEPRECATED API USED rest-*')
497-
498-
l2.daemon.logsearch_start = 0
499-
# We still rename this one, since it's for clnrest.
500-
assert l2.daemon.is_in_log(r'UNUSUAL lightningd: Option rest-host=.* deprecated in v23\.11, renaming to clnrest-host')
501-
502-
# This one does not get renamed!
503-
assert not l2.daemon.is_in_log(r'UNUSUAL lightningd: Option rest-port=.* deprecated in v23\.11, renaming to clnrest-host')
504-
assert [p for p in l2.rpc.plugin('list')['plugins'] if p['name'].endswith('clnrest')] == []
505-
assert l2.daemon.is_in_log(r'plugin-clnrest: Killing plugin: disabled itself at init: `clnrest-port` option is not configured')
506-
assert l2.daemon.is_in_log(rf'clnrest-use-options.py: rest-port is {rest_port}')
507-
508-
509472
def test_websocket_upgrade_header(node_factory):
510473
"""Test that not setting an upgrade header leads to rejection"""
511474
# start a node with clnrest

0 commit comments

Comments
 (0)