mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-21 08:04:26 +01:00
commit_tx: keep permutation map.
This lets us map the HTLCs back to outputs when txs occur onchain. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -42,7 +42,8 @@ struct bitcoin_tx *create_commit_tx(const tal_t *ctx,
|
||||
unsigned int anchor_index,
|
||||
u64 anchor_satoshis,
|
||||
const struct sha256 *rhash,
|
||||
const struct channel_state *cstate)
|
||||
const struct channel_state *cstate,
|
||||
int **map)
|
||||
{
|
||||
struct bitcoin_tx *tx;
|
||||
const u8 *redeemscript;
|
||||
@@ -94,7 +95,8 @@ struct bitcoin_tx *create_commit_tx(const tal_t *ctx,
|
||||
}
|
||||
assert(num == tx->output_count);
|
||||
assert(total <= anchor_satoshis);
|
||||
|
||||
permute_outputs(tx->output, tx->output_count, NULL);
|
||||
|
||||
*map = tal_arr(ctx, int, tx->output_count);
|
||||
permute_outputs(tx->output, tx->output_count, *map);
|
||||
return tx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user