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
This commit is contained in:
Michael Schmoock 2021-09-15 16:19:06 +02:00 committed by Rusty Russell
parent 35c6f90666
commit 45f6bf6cf1

View file

@ -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;