From 5284ee4dae1f0ac417764af93ce296cc01c3c355 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 3 Dec 2021 09:08:00 +1030 Subject: [PATCH] connectd: don't advertize websocket support if we have no other (non-Tor) addrs. Signed-off-by: Rusty Russell --- connectd/connectd.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/connectd/connectd.c b/connectd/connectd.c index 677f9bd0b..8ed57ebb0 100644 --- a/connectd/connectd.c +++ b/connectd/connectd.c @@ -1420,9 +1420,13 @@ static struct wireaddr_internal *setup_listeners(const tal_t *ctx, * getinfo. */ } - /* We add the websocket port to the announcement if it - * applies to any */ - if (announced_some) { + /* We add the websocket port to the announcement if we made one + * *and* we have other announced addresses. */ + /* BOLT-websocket #7: + * - MUST NOT add a `type 6` address unless there is also at + * least one address of different type. + */ + if (announced_some && tal_count(*announcable) != 0) { wireaddr_from_websocket(&addr, daemon->websocket_port); add_announcable(announcable, &addr); }