From e66cf46a7199d656149b084681236bdef8a14f00 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 30 May 2023 13:58:18 +0930 Subject: [PATCH] connectd: don't advertise websocket addresses. I never really liked this hack: websockets are useful, advertizing them not so much. Note that we never actually documented that we would advertize these! Changelog-EXPERIMENTAL: Protocol: Removed support for advertizing websocket addresses in gossip. Signed-off-by: Rusty Russell --- connectd/connectd.c | 35 ++++------------------------------- tests/test_connection.py | 6 +++--- 2 files changed, 7 insertions(+), 34 deletions(-) diff --git a/connectd/connectd.c b/connectd/connectd.c index 1de494c51..bcee78d22 100644 --- a/connectd/connectd.c +++ b/connectd/connectd.c @@ -1285,8 +1285,6 @@ setup_listeners(const tal_t *ctx, /* Only consider bindings added before this! */ size_t num_nonws_listens = tal_count(listen_fds); - /* If not overriden below, this is the default. */ - *errstr = "Cannot listen on websocket: not listening on any IPv4/6 addresses"; for (size_t i = 0; i < num_nonws_listens; i++) { /* Ignore UNIX sockets */ if (listen_fds[i]->wi.itype != ADDR_INTERNAL_WIREADDR) @@ -1305,40 +1303,15 @@ setup_listeners(const tal_t *ctx, if (!lfd) continue; - if (!announced_some) { - /* BOLT-websocket #7: - * - MUST NOT add a `type 6` address unless - * there is also at least one address of - * different type. - */ - if (tal_count(*announceable) != 0) { - /* See https://github.com/lightningnetwork/lnd/issues/6432: - * if we add websocket to the node_announcement, it doesn't propagate. - * So we do not do this for now in general! */ - if (daemon->announce_websocket) { - wireaddr_from_websocket(&addr.u.wireaddr, - daemon->websocket_port); - add_announceable(announceable, - &addr.u.wireaddr); - } - } else { - status_unusual("Bound to websocket %s," - " but we cannot announce" - " the websocket as we don't" - " announce anything else!", - type_to_string(tmpctx, - struct wireaddr_internal, - &addr)); - } - announced_some = true; - } - + announced_some = true; tal_arr_expand(&listen_fds, tal_steal(listen_fds, lfd)); } /* If none of those was possible, it's a configuration error? */ - if (tal_count(listen_fds) == num_nonws_listens) + if (tal_count(listen_fds) == num_nonws_listens) { + *errstr = "Cannot listen on websocket: not listening on any IPv4/6 addresses"; return NULL; + } } /* FIXME: Websocket over Tor (difficult for autotor, since we need diff --git a/tests/test_connection.py b/tests/test_connection.py index d39e6c815..6d4f12d1d 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -4116,9 +4116,9 @@ def test_websocket(node_factory): if int.from_bytes(msg[0:2], 'big') == 19: break - # Check node_announcement has websocket - ws_address = {'type': 'websocket', 'port': ws_port} - assert ws_address in only_one(l2.rpc.listnodes(l1.info['id'])['nodes'])['addresses'] + # Check node_announcement does NOT have websocket + assert not any([a['type'] == 'websocket' + for a in only_one(l2.rpc.listnodes(l1.info['id'])['nodes'])['addresses']]) @pytest.mark.developer("dev-disconnect required")