2017-08-28 18:06:01 +02:00
|
|
|
#ifndef LIGHTNING_COMMON_WITHDRAW_TX_H
|
|
|
|
#define LIGHTNING_COMMON_WITHDRAW_TX_H
|
2017-06-20 16:46:31 +02:00
|
|
|
#include "config.h"
|
2019-07-30 16:14:43 +02:00
|
|
|
#include <bitcoin/chainparams.h>
|
2017-06-20 16:46:31 +02:00
|
|
|
#include <ccan/short_types/short_types.h>
|
|
|
|
#include <ccan/tal/tal.h>
|
2019-02-21 04:45:55 +01:00
|
|
|
#include <common/amount.h>
|
2017-06-20 16:46:31 +02:00
|
|
|
|
|
|
|
struct bitcoin_tx;
|
|
|
|
struct ext_key;
|
|
|
|
struct privkey;
|
|
|
|
struct pubkey;
|
|
|
|
struct bitcoin_address;
|
|
|
|
struct utxo;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* withdraw_tx - Create a p2pkh withdrawal transaction
|
|
|
|
*
|
|
|
|
* @ctx: context to tal from.
|
2019-07-30 16:14:43 +02:00
|
|
|
* @chainparams: (in) the params for the created transaction.
|
2017-06-20 16:46:31 +02:00
|
|
|
* @utxos: (in/out) tal_arr of UTXO pointers to spend (permuted to match)
|
2017-12-10 06:48:18 +01:00
|
|
|
* @destination: (in) tal_arr of u8, scriptPubKey to send to.
|
2017-06-20 16:46:31 +02:00
|
|
|
* @amount: (in) satoshis to send to the destination
|
|
|
|
* @changekey: (in) key to send change to (only used if change_satoshis != 0).
|
2019-02-21 04:45:55 +01:00
|
|
|
* @change: (in) amount to send as change.
|
2017-06-20 16:46:31 +02:00
|
|
|
* @bip32_base: (in) bip32 base for key derivation, or NULL.
|
2019-06-05 07:28:57 +02:00
|
|
|
* @change_outnum: (out) set to output index of change output or -1 if none, unless NULL.
|
2017-06-20 16:46:31 +02:00
|
|
|
*/
|
|
|
|
struct bitcoin_tx *withdraw_tx(const tal_t *ctx,
|
2019-07-30 16:14:43 +02:00
|
|
|
const struct chainparams *chainparams,
|
2017-06-20 16:46:31 +02:00
|
|
|
const struct utxo **utxos,
|
2019-06-05 07:28:57 +02:00
|
|
|
const u8 *destination,
|
2019-02-21 04:45:55 +01:00
|
|
|
struct amount_sat withdraw_amount,
|
2017-06-20 16:46:31 +02:00
|
|
|
const struct pubkey *changekey,
|
2019-02-21 04:45:55 +01:00
|
|
|
struct amount_sat change,
|
2019-06-05 07:28:57 +02:00
|
|
|
const struct ext_key *bip32_base,
|
|
|
|
int *change_outnum);
|
2017-06-20 16:46:31 +02:00
|
|
|
|
2017-08-28 18:06:01 +02:00
|
|
|
#endif /* LIGHTNING_COMMON_WITHDRAW_TX_H */
|