From 040cda28757f0075c3c0bb3c2f11cc8dcb6b3b0d Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Tue, 6 Aug 2019 12:38:20 +0200 Subject: [PATCH] bitcoind: Initialize filteredblock->outpoints with filteredblock We will be calling the callback out of order once we fan out the results of a single lookip to multiple calls, so being sure that everything is allocated ahead of time is necessary. Signed-off-by: Christian Decker --- lightningd/bitcoind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lightningd/bitcoind.c b/lightningd/bitcoind.c index fdbd2e077..c6260c00e 100644 --- a/lightningd/bitcoind.c +++ b/lightningd/bitcoind.c @@ -852,8 +852,6 @@ static void process_getfilteredblock_step2(struct bitcoind *bitcoind, } } - call->result->outpoints = tal_arr(call->result, struct filteredblock_outpoint *, 0); - call->current_outpoint = 0; if (tal_count(call->outpoints) == 0) { /* If there were no outpoints to check, we can short-circuit * and just call the callback. */ @@ -897,6 +895,8 @@ void bitcoind_getfilteredblock_(struct bitcoind *bitcoind, u32 height, assert(call->cb != NULL); call->start_time = time_now(); call->result->height = height; + call->result->outpoints = tal_arr(call->result, struct filteredblock_outpoint *, 0); + call->current_outpoint = 0; bitcoind_getblockhash(bitcoind, height, process_getfilteredblock_step1, call); }