2017-08-28 18:06:01 +02:00
|
|
|
#ifndef LIGHTNING_COMMON_FUNDING_TX_H
|
|
|
|
#define LIGHTNING_COMMON_FUNDING_TX_H
|
2017-02-07 02:44:21 +01:00
|
|
|
#include "config.h"
|
|
|
|
#include <ccan/short_types/short_types.h>
|
|
|
|
#include <ccan/tal/tal.h>
|
|
|
|
|
|
|
|
struct bitcoin_tx;
|
2017-03-07 02:01:55 +01:00
|
|
|
struct ext_key;
|
2017-02-07 02:44:21 +01:00
|
|
|
struct privkey;
|
|
|
|
struct pubkey;
|
2017-02-24 06:52:56 +01:00
|
|
|
struct utxo;
|
2017-02-07 02:44:21 +01:00
|
|
|
|
2017-02-24 06:52:56 +01:00
|
|
|
/**
|
|
|
|
* funding_tx: create a P2WSH funding transaction for a channel.
|
|
|
|
* @ctx: context to tal from.
|
2017-03-07 01:58:09 +01:00
|
|
|
* @outnum: (out) txout (0 or 1) which is the funding output.
|
|
|
|
* @utxomap: (in/out) tal_arr of UTXO pointers to spend (permuted to match)
|
|
|
|
* @funding_satoshis: (in) satoshis to output.
|
|
|
|
* @local_fundingkey: (in) local key for 2of2 funding output.
|
|
|
|
* @remote_fundingkey: (in) remote key for 2of2 funding output.
|
|
|
|
* @change_satoshis: (in) amount to send as change.
|
|
|
|
* @changekey: (in) key to send change to (only used if change_satoshis != 0).
|
2017-03-07 02:01:55 +01:00
|
|
|
* @bip32_base: (in) bip32 base for key derivation, or NULL.
|
|
|
|
*
|
|
|
|
* If bip32_base is supplied, scriptSig will be added for p2sh inputs: this
|
|
|
|
* means our signing code will fail, but txid will be correct. If NULL,
|
|
|
|
* the txid will be incorrect, by signing will succeed.
|
|
|
|
*
|
|
|
|
* This is done because all other txs have no scriptSig (being pure Segwit)
|
|
|
|
* so our signature code simply asserts there's no scriptsig (which would
|
|
|
|
* have to be removed for signing anyway). The funding transaction is
|
|
|
|
* a special case because of the P2SH inputs.
|
2017-02-24 06:52:56 +01:00
|
|
|
*/
|
2017-02-07 02:44:21 +01:00
|
|
|
struct bitcoin_tx *funding_tx(const tal_t *ctx,
|
2017-03-07 02:03:24 +01:00
|
|
|
u16 *outnum,
|
2017-03-07 01:58:09 +01:00
|
|
|
const struct utxo **utxomap,
|
2017-02-07 02:44:21 +01:00
|
|
|
u64 funding_satoshis,
|
|
|
|
const struct pubkey *local_fundingkey,
|
|
|
|
const struct pubkey *remote_fundingkey,
|
2017-03-07 01:58:09 +01:00
|
|
|
u64 change_satoshis,
|
2017-03-07 02:01:55 +01:00
|
|
|
const struct pubkey *changekey,
|
|
|
|
const struct ext_key *bip32_base);
|
2017-08-28 18:06:01 +02:00
|
|
|
#endif /* LIGHTNING_COMMON_FUNDING_TX_H */
|