From 45f6bf6cf199bf6c5bda3f4b765c33bf75914a55 Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Wed, 15 Sep 2021 16:19:06 +0200 Subject: [PATCH] options: fix ld proposed_wireaddr proposed_listen_announce get out of sync Incase the error handling happening after the quted line is non-critical: ``` return tal_fmt(NULL, "Unable to parse address '%s': %s", arg, err_msg); ``` we should not expand the proposed_listen_announce array without adding a proposed_wireaddr. So we move the expand of proposed_listen_announce to the location where we also expand the proposed_wireaddr. Changelog-None --- lightningd/options.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lightningd/options.c b/lightningd/options.c index 54dde2aa6..6c042caff 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -191,7 +191,6 @@ static char *opt_add_addr_withtype(const char *arg, assert(arg != NULL); - tal_arr_expand(&ld->proposed_listen_announce, ala); if (!parse_wireaddr_internal(arg, &wi, ld->portnum, wildcard_ok, !ld->always_use_proxy, false, @@ -210,6 +209,8 @@ static char *opt_add_addr_withtype(const char *arg, ala & ADDR_ANNOUNCE ? "announce" : "listen", type_to_string(tmpctx, struct wireaddr_internal, &wi)); } + + tal_arr_expand(&ld->proposed_listen_announce, ala); tal_arr_expand(&ld->proposed_wireaddr, wi); return NULL;