1 #ifndef LIGHTNING_COMMON_PERMUTE_TX_H
2 #define LIGHTNING_COMMON_PERMUTE_TX_H
3 #include "config.h"
4 #include "bitcoin/tx.h"
5 
6 struct htlc;
7 
8 /**
9  * permute_inputs: permute the transaction inputs into BIP69 order.
10  * @tx: the transaction whose inputs are to be sorted (inputs must be tal_arr).
11  * @map: if non-NULL, pointers to be permuted the same as the inputs.
12  */
13 void permute_inputs(struct bitcoin_tx *tx, const void **map);
14 
15 /**
16  * permute_outputs: permute the transaction outputs into BIP69 + cltv order.
17  * @tx: the transaction whose outputs are to be sorted (outputs must be tal_arr).
18  * @cltvs: CLTV delays to use as a tie-breaker, or NULL.
19  * @map: if non-NULL, pointers to be permuted the same as the outputs.
20  *
21  * So the caller initiates the map with which htlcs are used, it
22  * can easily see which htlc (if any) is in output #0 with map[0].
23  */
24 void permute_outputs(struct bitcoin_tx *tx, u32 *cltvs, const void **map);
25 #endif /* LIGHTNING_COMMON_PERMUTE_TX_H */
26