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.
|
2019-03-14 17:47:13 +01:00
|
|
|
* @tx: the transaction whose inputs are to be sorted (inputs must be tal_arr).
|
2018-10-22 06:21:05 +02:00
|
|
|
* @map: if non-NULL, pointers to be permuted the same as the inputs.
|
|
|
|
*/
|
2019-03-14 17:47:13 +01:00
|
|
|
void permute_inputs(struct bitcoin_tx *tx, 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.
|
2019-03-14 17:47:13 +01:00
|
|
|
* @tx: the transaction whose outputs are to be sorted (outputs must be tal_arr).
|
2018-10-22 06:21:05 +02:00
|
|
|
* @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
|
|
|
*/
|
2019-03-14 17:47:13 +01:00
|
|
|
void permute_outputs(struct bitcoin_tx *tx, u32 *cltvs, const void **map);
|
2017-08-28 18:06:01 +02:00
|
|
|
#endif /* LIGHTNING_COMMON_PERMUTE_TX_H */
|