2017-08-28 18:06:01 +02:00
|
|
|
#ifndef LIGHTNING_COMMON_PERMUTE_TX_H
|
|
|
|
#define LIGHTNING_COMMON_PERMUTE_TX_H
|
2016-01-21 21:08:08 +01:00
|
|
|
#include "config.h"
|
2015-06-12 04:23:27 +02:00
|
|
|
#include "bitcoin/tx.h"
|
2015-05-29 05:29:09 +02:00
|
|
|
|
2017-02-07 02:44:22 +01:00
|
|
|
struct htlc;
|
|
|
|
|
2018-10-22 06:21:05 +02:00
|
|
|
/**
|
|
|
|
* permute_inputs: permute the transaction inputs into BIP69 order.
|
|
|
|
* @inputs: usually bitcoin_tx->inputs, must be tal_arr.
|
|
|
|
* @map: if non-NULL, pointers to be permuted the same as the inputs.
|
|
|
|
*/
|
|
|
|
void permute_inputs(struct bitcoin_tx_input *inputs, const void **map);
|
2015-05-29 05:29:09 +02:00
|
|
|
|
2018-10-22 06:21:05 +02:00
|
|
|
/**
|
|
|
|
* permute_outputs: permute the transaction outputs into BIP69 + cltv order.
|
|
|
|
* @outputs: usually bitcoin_tx->outputs, must be tal_arr.
|
|
|
|
* @cltvs: CLTV delays to use as a tie-breaker, or NULL.
|
|
|
|
* @map: if non-NULL, pointers to be permuted the same as the outputs.
|
2017-02-07 02:44:22 +01:00
|
|
|
*
|
2017-02-21 05:45:29 +01:00
|
|
|
* So the caller initiates the map with which htlcs are used, it
|
|
|
|
* can easily see which htlc (if any) is in output #0 with map[0].
|
2017-02-07 02:44:22 +01:00
|
|
|
*/
|
2018-10-22 06:21:05 +02:00
|
|
|
void permute_outputs(struct bitcoin_tx_output *outputs,
|
|
|
|
u32 *cltvs,
|
2017-02-21 05:45:29 +01:00
|
|
|
const void **map);
|
2017-08-28 18:06:01 +02:00
|
|
|
#endif /* LIGHTNING_COMMON_PERMUTE_TX_H */
|