From 5ddd7866e408b0c4edc59097aee7e3ac3c414f2f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 16 Sep 2019 14:40:15 +0930 Subject: [PATCH] gossipd: make create_node_announcement const-correct. sig is only non-const so we can override if NULL, but talz helps us here. Signed-off-by: Rusty Russell --- gossipd/gossipd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gossipd/gossipd.c b/gossipd/gossipd.c index 02e920576..9b3b3af3c 100644 --- a/gossipd/gossipd.c +++ b/gossipd/gossipd.c @@ -460,16 +460,16 @@ static void setup_gossip_range(struct peer *peer) * handed in rather than using time_now() internally, since that could change * between the dummy creation and the call with a signature. */ static u8 *create_node_announcement(const tal_t *ctx, struct daemon *daemon, - secp256k1_ecdsa_signature *sig, + const secp256k1_ecdsa_signature *sig, u32 timestamp) { u8 *addresses = tal_arr(tmpctx, u8, 0); u8 *announcement; size_t i; - if (!sig) { - sig = tal(tmpctx, secp256k1_ecdsa_signature); - memset(sig, 0, sizeof(*sig)); - } + + if (!sig) + sig = talz(tmpctx, secp256k1_ecdsa_signature); + for (i = 0; i < tal_count(daemon->announcable); i++) towire_wireaddr(&addresses, &daemon->announcable[i]);