From 30dea0a4312fc8bbbc22923856e22e949190fc10 Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Tue, 20 Dec 2022 18:28:46 +0100 Subject: [PATCH] opts: deprecate --disable-ip-discovery switch This switch was not doing anything useful anymore. We deprecate it anyways to notify the user about the new switch. Changelog-Deprecated: The old --disable-ip-discovery config switch --- doc/lightning-listconfigs.7.md | 4 ++-- doc/lightningd-config.5.md | 8 -------- doc/schemas/listconfigs.schema.json | 3 ++- lightningd/lightningd.h | 2 -- lightningd/options.c | 15 ++++++++------- lightningd/peer_control.c | 3 ++- 6 files changed, 14 insertions(+), 21 deletions(-) diff --git a/doc/lightning-listconfigs.7.md b/doc/lightning-listconfigs.7.md index 24f050901..54c7c59da 100644 --- a/doc/lightning-listconfigs.7.md +++ b/doc/lightning-listconfigs.7.md @@ -88,7 +88,7 @@ On success, an object is returned, containing: - **autolisten** (boolean, optional): `autolisten` field from config or cmdline, or default - **proxy** (string, optional): `proxy` field from config or cmdline, or default - **disable-dns** (boolean, optional): `true` if `disable-dns` was set in config or cmdline -- **disable-ip-discovery** (boolean, optional): `true` if `disable-ip-discovery` was set in config or cmdline (DEPRECATED) +- **disable-ip-discovery** (boolean, optional): `true` if `disable-ip-discovery` was set in config or cmdline **deprecated, removal in v23.11** - **announce-addr-discovered** (string, optional): `true`/`false`/`auto` depending on how `announce-addr-discovered` was set in config or cmdline *(added v23.02)* - **encrypted-hsm** (boolean, optional): `true` if `encrypted-hsm` was set in config or cmdline - **rpc-file-mode** (string, optional): `rpc-file-mode` field from config or cmdline, or default @@ -221,4 +221,4 @@ RESOURCES Main web site: -[comment]: # ( SHA256STAMP:fcf5e537989d9df2cf2031ff6b7589cc1d6acc30a81806e7ecedb3265b8c9b3b) +[comment]: # ( SHA256STAMP:9953b3545acb82bed816b86a65ba51ff4b043d3848c4a3ae460aa68db1a4b542) diff --git a/doc/lightningd-config.5.md b/doc/lightningd-config.5.md index bb376c86d..5c679b6b4 100644 --- a/doc/lightningd-config.5.md +++ b/doc/lightningd-config.5.md @@ -368,14 +368,6 @@ use the RPC call lightning-setchannel(7). Note: You also need to open TCP port 9735 on your router towords your node. Note: Will always be disabled if you use 'always-use-proxy'. -* **disable-ip-discovery** - - Turn off public IP discovery to send `node_announcement` updates that contain -the discovered IP with TCP port 9735 as announced address. If unset and you -open TCP port 9735 on your router towords your node, your node will remain -connectable on changing IP addresses. Note: Will always be disabled if you use -'always-use-proxy'. - ### Lightning channel and HTLC options * **large-channels** diff --git a/doc/schemas/listconfigs.schema.json b/doc/schemas/listconfigs.schema.json index fc52dffb6..15c085df6 100644 --- a/doc/schemas/listconfigs.schema.json +++ b/doc/schemas/listconfigs.schema.json @@ -245,7 +245,8 @@ }, "disable-ip-discovery": { "type": "boolean", - "description": "`true` if `disable-ip-discovery` was set in config or cmdline" + "description": "`true` if `disable-ip-discovery` was set in config or cmdline", + "deprecated": "v23.02" }, "announce-addr-discovered": { "type": "string", diff --git a/lightningd/lightningd.h b/lightningd/lightningd.h index 3d1d367e8..eec2f8508 100644 --- a/lightningd/lightningd.h +++ b/lightningd/lightningd.h @@ -61,8 +61,6 @@ struct config { /* Excplicitly turns 'on' or 'off' IP discovery feature. */ enum opt_autobool ip_discovery; - /* Turn off IP address announcement discovered via peer `remote_addr` */ - bool disable_ip_discovery; /* Minimal amount of effective funding_satoshis for accepting channels */ u64 min_capacity_sat; diff --git a/lightningd/options.c b/lightningd/options.c index f3b72e9a2..89403c15c 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -845,8 +845,6 @@ static const struct config testnet_config = { /* Excplicitly turns 'on' or 'off' IP discovery feature. */ .ip_discovery = OPT_AUTOBOOL_AUTO, - /* Turn off IP address announcement discovered via peer `remote_addr` */ - .disable_ip_discovery = false, /* Sets min_effective_htlc_capacity - at 1000$/BTC this is 10ct */ .min_capacity_sat = 10000, @@ -913,8 +911,6 @@ static const struct config mainnet_config = { /* Excplicitly turns 'on' or 'off' IP discovery feature. */ .ip_discovery = OPT_AUTOBOOL_AUTO, - /* Turn off IP address announcement discovered via peer `remote_addr` */ - .disable_ip_discovery = false, /* Sets min_effective_htlc_capacity - at 1000$/BTC this is 10ct */ .min_capacity_sat = 10000, @@ -1084,6 +1080,13 @@ static char *opt_set_db_upgrade(const char *arg, struct lightningd *ld) return opt_set_bool_arg(arg, ld->db_upgrade_ok); } +static char *opt_disable_ip_discovery(struct lightningd *ld) +{ + log_broken(ld->log, "--disable-ip-discovery has been deprecated, use --announce-addr-discovered=false"); + ld->config.ip_discovery = OPT_AUTOBOOL_FALSE; + return NULL; +} + static void register_opts(struct lightningd *ld) { /* This happens before plugins started */ @@ -1216,9 +1219,7 @@ static void register_opts(struct lightningd *ld) ld, "Set an IP address (v4 or v6) or .onion v3 to announce, but not listen on"); - opt_register_noarg("--disable-ip-discovery", opt_set_bool, - &ld->config.disable_ip_discovery, - "Turn off announcement of discovered public IPs"); + opt_register_noarg("--disable-ip-discovery", opt_disable_ip_discovery, ld, opt_hidden); opt_register_arg("--announce-addr-discovered", opt_set_autobool_arg, opt_show_autobool, &ld->config.ip_discovery, "Explicitly turns IP discovery 'on' or 'off'."); diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index bb3128bca..9718d136c 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -1308,7 +1308,8 @@ static void update_remote_addr(struct lightningd *ld, u16 public_port; /* failsafe to prevent privacy leakage. */ - if (ld->always_use_proxy || ld->config.disable_ip_discovery) + if (ld->always_use_proxy || + ld->config.ip_discovery == OPT_AUTOBOOL_FALSE) return; /* Peers will have likey reported our dynamic outbound TCP port.