lightningd: deprecated --announce-addr-dns.

This obsoletes the use of --announce-addr-dns which I know Michael
didn't really like either.

Changelog-Deprecated: Config: `announce-addr-dns`; use `--bind-addr=dns:ADDR` for finer control.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-05-30 13:58:18 +09:30
parent 6d0b46c9b1
commit 21958879cf
5 changed files with 21 additions and 14 deletions

View file

@ -106,7 +106,7 @@ On success, an object is returned, containing:
- **accept-htlc-tlv-types** (string, optional): `accept-htlc-tlv-types` fields from config or cmdline, or not present
- **tor-service-password** (string, optional): `tor-service-password` field from config or cmdline, if any
- **dev-allowdustreserve** (boolean, optional): Whether we allow setting dust reserves
- **announce-addr-dns** (boolean, optional): Whether we put DNS entries into node\_announcement *(added v22.11.1)*
- **announce-addr-dns** (boolean, optional): Whether we put DNS entries into node\_announcement **deprecated, removal in v24.05** *(added v22.11.1)*
- **require-confirmed-inputs** (boolean, optional): Request peers to only send confirmed inputs (dual-fund only)
- **commit-fee** (u64, optional): The percentage of the 6-block fee estimate to use for commitment transactions *(added v23.05)*
@ -226,4 +226,4 @@ RESOURCES
Main web site: <https://github.com/ElementsProject/lightning>
[comment]: # ( SHA256STAMP:4e361c39e45812c4dd1e168c3e4e0960f06511850db7b70475b4b547e92f3bc2)
[comment]: # ( SHA256STAMP:a0058065f618170918c09d1672d5800beeff01f0fd2d13914a4ec238398f30c3)

View file

@ -571,7 +571,7 @@ its use disables autolisten.
Since v23.058, the `dns:` prefix can be used to indicate that this hostname and port should be announced as a DNS hostname entry. Please note that most mainnet nodes do not yet use, read or propagate this information correctly.
* **announce-addr-dns**=*BOOL*
* **announce-addr-dns**=*BOOL* (deprecated in v23.08)
When set to *true* (default is *false*), prefixes all `HOSTNAME` in **announce-addr** with `dns:`.

View file

@ -324,6 +324,7 @@
"announce-addr-dns": {
"type": "boolean",
"added": "v22.11.1",
"deprecated": "v23.08",
"description": "Whether we put DNS entries into node_announcement"
},
"require-confirmed-inputs": {

View file

@ -1141,6 +1141,13 @@ static char *opt_disable_ip_discovery(struct lightningd *ld)
return NULL;
}
static char *opt_set_announce_dns(const char *optarg, struct lightningd *ld)
{
if (!deprecated_apis)
return "--announce-addr-dns has been deprecated, use --bind-addr=dns:...";
return opt_set_bool_arg(optarg, &ld->announce_dns);
}
static void register_opts(struct lightningd *ld)
{
/* This happens before plugins started */
@ -1208,9 +1215,8 @@ static void register_opts(struct lightningd *ld)
"experimental: Advertise ability to quiesce"
" channels.");
opt_register_early_arg("--announce-addr-dns",
opt_set_bool_arg, opt_show_bool,
&ld->announce_dns,
"Use DNS entries in --announce-addr and --addr (not widely supported!)");
opt_set_announce_dns, NULL,
ld, opt_hidden);
opt_register_noarg("--help|-h", opt_lightningd_usage, ld,
"Print this message.");
@ -1790,6 +1796,9 @@ static void add_config(struct lightningd *ld,
json_add_bool(response, name0,
*ld->db_upgrade_ok);
return;
} else if (opt->cb_arg == (void *)opt_set_announce_dns) {
json_add_bool(response, name0, ld->announce_dns);
return;
} else if (opt->cb_arg == (void *)opt_important_plugin) {
/* Do nothing, this is already handled by
* opt_add_plugin. */

View file

@ -117,11 +117,10 @@ def test_announce_address(node_factory, bitcoind):
"""Make sure our announcements are well formed."""
# We do not allow announcement of duplicates.
opts = {'announce-addr-dns': True,
'announce-addr':
opts = {'announce-addr':
['4acth47i6kxnvkewtm6q7ib2s3ufpo5sqbsnzjpbi7utijcltosqemad.onion',
'1.2.3.4:1234',
'example.com:1236',
'dns:example.com:1236',
'::'],
'log-level': 'io',
'dev-allow-localhost': None}
@ -202,8 +201,7 @@ def test_announce_and_connect_via_dns(node_factory, bitcoind):
- 'dev-allow-localhost' must not be set, so it does not resolve localhost anyway.
"""
opts1 = {'disable-dns': None,
'announce-addr-dns': True,
'announce-addr': ['localhost.localdomain:12345'], # announce dns
'announce-addr': ['dns:localhost.localdomain:12345'], # announce dns
'bind-addr': ['127.0.0.1:12345', '[::1]:12345']} # and bind local IPs
opts3 = {'may_reconnect': True}
opts4 = {'disable-dns': None}
@ -252,8 +250,7 @@ def test_announce_and_connect_via_dns(node_factory, bitcoind):
def test_only_announce_one_dns(node_factory, bitcoind):
# and test that we can't announce more than one DNS address
l1 = node_factory.get_node(expect_fail=True, start=False,
options={'announce-addr-dns': True,
'announce-addr': ['localhost.localdomain:12345', 'example.com:12345']})
options={'announce-addr': ['dns:localhost.localdomain:12345', 'dns:example.com:12345']})
l1.daemon.start(wait_for_initialized=False, stderr_redir=True)
wait_for(lambda: l1.daemon.is_in_stderr("Only one DNS can be announced"))
@ -262,7 +259,7 @@ def test_announce_dns_without_port(node_factory, bitcoind):
""" Checks that the port of a DNS announcement is set to the corresponding
network port. In this case regtest 19846
"""
opts = {'announce-addr-dns': True, 'announce-addr': ['example.com']}
opts = {'announce-addr': ['dns:example.com']}
l1 = node_factory.get_node(options=opts)
# 'address': [{'type': 'dns', 'address': 'example.com', 'port': 0}]