From 7e13e9e457f8486a278774da06eb9e4b27227abf Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 31 Aug 2017 11:34:42 +0930 Subject: [PATCH] channeld: don't allow NULL htlcmap for full_channel That was only for the initial state, which is now in initial_channel.c. Signed-off-by: Rusty Russell --- channeld/full_channel.c | 7 +------ channeld/full_channel.h | 7 +++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/channeld/full_channel.c b/channeld/full_channel.c index c8716262a..9a73df313 100644 --- a/channeld/full_channel.c +++ b/channeld/full_channel.c @@ -250,10 +250,6 @@ struct bitcoin_tx **channel_txs(const tal_t *ctx, /* Figure out what @side will already be committed to. */ gather_htlcs(ctx, channel, side, &committed, NULL, NULL); - /* NULL map only allowed at beginning, when we know no HTLCs */ - if (!htlcmap) - assert(tal_count(committed) == 0); - txs = tal_arr(ctx, struct bitcoin_tx *, 1); txs[0] = commit_tx(ctx, &channel->funding_txid, channel->funding_txout, @@ -275,8 +271,7 @@ struct bitcoin_tx **channel_txs(const tal_t *ctx, &channel->funding_pubkey[side], &channel->funding_pubkey[!side]); - if (htlcmap) - add_htlcs(&txs, wscripts, *htlcmap, channel, &keyset, side); + add_htlcs(&txs, wscripts, *htlcmap, channel, &keyset, side); tal_free(committed); return txs; diff --git a/channeld/full_channel.h b/channeld/full_channel.h index cec52da0e..60b938373 100644 --- a/channeld/full_channel.h +++ b/channeld/full_channel.h @@ -43,16 +43,15 @@ struct channel *new_channel(const tal_t *ctx, * channel_txs: Get the current commitment and htlc txs for the channel. * @ctx: tal context to allocate return value from. * @channel: The channel to evaluate - * @htlc_map: Pointer to htlcs for each tx output (allocated off @ctx) or NULL. + * @htlc_map: Pointer to htlcs for each tx output (allocated off @ctx). * @wscripts: Pointer to array of wscript for each tx returned (alloced off @ctx) * @per_commitment_point: Per-commitment point to determine keys * @commitment_number: The index of this commitment. * @side: which side to get the commitment transaction for * * Returns the unsigned commitment transaction for the committed state - * for @side, followed by the htlc transactions in output order, and - * fills in @htlc_map (if not NULL), or NULL on key derivation - * failure. + * for @side, followed by the htlc transactions in output order and + * fills in @htlc_map, or NULL on key derivation failure. */ struct bitcoin_tx **channel_txs(const tal_t *ctx, const struct htlc ***htlcmap,