core-lightning/common/withdraw_tx.h
lisa neigut 16656a85cf withdraw: refactor change output handling
We're not using the change_outnum for withdraw tx's (and the way
we were calculating it was broken as of the addition of 'multiple
outputs'). This removes the change output knowhow from withdraw_tx
entirely, and pushes the responsibility up to the caller to
include the change output in the output set if desired.

Consequently, we also remove the change output knowhow from hsmd.
2020-06-23 14:49:32 +02:00

35 lines
1.1 KiB
C

#ifndef LIGHTNING_COMMON_WITHDRAW_TX_H
#define LIGHTNING_COMMON_WITHDRAW_TX_H
#include "config.h"
#include <bitcoin/chainparams.h>
#include <bitcoin/tx.h>
#include <ccan/short_types/short_types.h>
#include <ccan/tal/tal.h>
#include <common/amount.h>
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.
* @chainparams: (in) the params for the created transaction.
* @utxos: (in/out) tal_arr of UTXO pointers to spend (permuted to match)
* @outputs: (in) tal_arr of bitcoin_tx_output, scriptPubKeys with amount to send to.
* @bip32_base: (in) bip32 base for key derivation, or NULL.
* @nlocktime: (in) the value to set as the transaction's nLockTime.
*/
struct bitcoin_tx *withdraw_tx(const tal_t *ctx,
const struct chainparams *chainparams,
const struct utxo **utxos,
struct bitcoin_tx_output **outputs,
const struct ext_key *bip32_base,
u32 nlocktime);
#endif /* LIGHTNING_COMMON_WITHDRAW_TX_H */