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 <decker.christian@gmail.com>
This commit is contained in:
Christian Decker 2019-08-06 12:38:20 +02:00 committed by Rusty Russell
parent 43b3eea783
commit 040cda2875

View File

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