Browse Source

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 <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
7e13e9e457
  1. 7
      channeld/full_channel.c
  2. 7
      channeld/full_channel.h

7
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. */ /* Figure out what @side will already be committed to. */
gather_htlcs(ctx, channel, side, &committed, NULL, NULL); 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 = tal_arr(ctx, struct bitcoin_tx *, 1);
txs[0] = commit_tx(ctx, &channel->funding_txid, txs[0] = commit_tx(ctx, &channel->funding_txid,
channel->funding_txout, channel->funding_txout,
@ -275,8 +271,7 @@ struct bitcoin_tx **channel_txs(const tal_t *ctx,
&channel->funding_pubkey[side], &channel->funding_pubkey[side],
&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); tal_free(committed);
return txs; return txs;

7
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. * channel_txs: Get the current commitment and htlc txs for the channel.
* @ctx: tal context to allocate return value from. * @ctx: tal context to allocate return value from.
* @channel: The channel to evaluate * @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) * @wscripts: Pointer to array of wscript for each tx returned (alloced off @ctx)
* @per_commitment_point: Per-commitment point to determine keys * @per_commitment_point: Per-commitment point to determine keys
* @commitment_number: The index of this commitment. * @commitment_number: The index of this commitment.
* @side: which side to get the commitment transaction for * @side: which side to get the commitment transaction for
* *
* Returns the unsigned commitment transaction for the committed state * Returns the unsigned commitment transaction for the committed state
* for @side, followed by the htlc transactions in output order, and * for @side, followed by the htlc transactions in output order and
* fills in @htlc_map (if not NULL), or NULL on key derivation * fills in @htlc_map, or NULL on key derivation failure.
* failure.
*/ */
struct bitcoin_tx **channel_txs(const tal_t *ctx, struct bitcoin_tx **channel_txs(const tal_t *ctx,
const struct htlc ***htlcmap, const struct htlc ***htlcmap,

Loading…
Cancel
Save