mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 17:47:30 +01:00
channeld: htlcmap is never NULL.
I audited the callers. So remove the code which tested this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
ad2519a6f4
commit
0c28c7b6a5
2 changed files with 10 additions and 15 deletions
|
@ -158,9 +158,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
|
|||
tx = bitcoin_tx(ctx, 1, untrimmed + 2);
|
||||
|
||||
/* We keep track of which outputs have which HTLCs */
|
||||
if (htlcmap)
|
||||
*htlcmap = tal_arr(tx, const struct htlc *,
|
||||
tal_count(tx->output));
|
||||
*htlcmap = tal_arr(tx, const struct htlc *, tal_count(tx->output));
|
||||
|
||||
/* This could be done in a single loop, but we follow the BOLT
|
||||
* literally to make comments in test vectors clearer. */
|
||||
|
@ -177,8 +175,8 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
|
|||
if (trim(htlcs[i], feerate_per_kw, dust_limit_satoshis, side))
|
||||
continue;
|
||||
add_offered_htlc_out(tx, n, htlcs[i], keyset);
|
||||
if (htlcmap)
|
||||
(*htlcmap)[n++] = htlcs[i];
|
||||
(*htlcmap)[n] = htlcs[i];
|
||||
n++;
|
||||
}
|
||||
|
||||
/* BOLT #3:
|
||||
|
@ -192,8 +190,8 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
|
|||
if (trim(htlcs[i], feerate_per_kw, dust_limit_satoshis, side))
|
||||
continue;
|
||||
add_received_htlc_out(tx, n, htlcs[i], keyset);
|
||||
if (htlcmap)
|
||||
(*htlcmap)[n++] = htlcs[i];
|
||||
(*htlcmap)[n] = htlcs[i];
|
||||
n++;
|
||||
}
|
||||
|
||||
/* BOLT #3:
|
||||
|
@ -206,7 +204,6 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
|
|||
u8 *wscript = to_self_wscript(tmpctx, to_self_delay,keyset);
|
||||
tx->output[n].amount = self_pay_msat / 1000;
|
||||
tx->output[n].script = scriptpubkey_p2wsh(tx, wscript);
|
||||
if (htlcmap)
|
||||
(*htlcmap)[n] = NULL;
|
||||
SUPERVERBOSE("# to-local amount %"PRIu64" wscript %s\n",
|
||||
tx->output[n].amount,
|
||||
|
@ -231,7 +228,6 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
|
|||
tx->output[n].amount = other_pay_msat / 1000;
|
||||
tx->output[n].script = scriptpubkey_p2wpkh(tx,
|
||||
&keyset->other_payment_key);
|
||||
if (htlcmap)
|
||||
(*htlcmap)[n] = NULL;
|
||||
SUPERVERBOSE("# to-remote amount %"PRIu64" P2WPKH(%s)\n",
|
||||
tx->output[n].amount,
|
||||
|
@ -242,7 +238,6 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
|
|||
|
||||
assert(n <= tal_count(tx->output));
|
||||
tal_resize(&tx->output, n);
|
||||
if (htlcmap)
|
||||
tal_resize(htlcmap, n);
|
||||
|
||||
/* BOLT #3:
|
||||
|
@ -251,7 +246,7 @@ struct bitcoin_tx *commit_tx(const tal_t *ctx,
|
|||
* order](#transaction-input-and-output-ordering)
|
||||
*/
|
||||
permute_outputs(tx->output, tal_count(tx->output),
|
||||
htlcmap ? (const void **)*htlcmap : NULL);
|
||||
(const void **)*htlcmap);
|
||||
|
||||
/* BOLT #3:
|
||||
*
|
||||
|
|
|
@ -33,7 +33,7 @@ size_t commit_tx_num_untrimmed(const struct htlc **htlcs,
|
|||
* @self_pay_msat: amount to pay directly to self
|
||||
* @other_pay_msat: amount to pay directly to the other side
|
||||
* @htlcs: tal_arr of htlcs committed by transaction (some may be trimmed)
|
||||
* @htlc_map: outputed map of outnum->HTLC (NULL for direct outputs), or NULL.
|
||||
* @htlc_map: outputed map of outnum->HTLC (NULL for direct outputs).
|
||||
* @obscured_commitment_number: number to encode in commitment transaction
|
||||
* @side: side to generate commitment transaction for.
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue