mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 13:25:43 +01:00
bitcoin: add nlocktime arg to create_psbt.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
7435d50970
commit
172b9d7ae3
@ -36,13 +36,13 @@ static struct wally_psbt *init_psbt(const tal_t *ctx, size_t num_inputs, size_t
|
||||
return tal_steal(ctx, psbt);
|
||||
}
|
||||
|
||||
struct wally_psbt *create_psbt(const tal_t *ctx, size_t num_inputs, size_t num_outputs)
|
||||
struct wally_psbt *create_psbt(const tal_t *ctx, size_t num_inputs, size_t num_outputs, u32 locktime)
|
||||
{
|
||||
int wally_err;
|
||||
struct wally_tx *wtx;
|
||||
struct wally_psbt *psbt;
|
||||
|
||||
if (wally_tx_init_alloc(WALLY_TX_VERSION_2, 0, num_inputs, num_outputs, &wtx) != WALLY_OK)
|
||||
if (wally_tx_init_alloc(WALLY_TX_VERSION_2, locktime, num_inputs, num_outputs, &wtx) != WALLY_OK)
|
||||
abort();
|
||||
|
||||
psbt = init_psbt(ctx, num_inputs, num_outputs);
|
||||
|
@ -25,8 +25,9 @@ void psbt_destroy(struct wally_psbt *psbt);
|
||||
* @ctx - allocation context
|
||||
* @num_inputs - number of inputs to allocate
|
||||
* @num_outputs - number of outputs to allocate
|
||||
* @locktime - locktime for the transaction
|
||||
*/
|
||||
struct wally_psbt *create_psbt(const tal_t *ctx, size_t num_inputs, size_t num_outputs);
|
||||
struct wally_psbt *create_psbt(const tal_t *ctx, size_t num_inputs, size_t num_outputs, u32 locktime);
|
||||
|
||||
/*
|
||||
* new_psbt - Create a PSBT, using the passed in tx
|
||||
|
@ -61,7 +61,7 @@ static const u8 *linearize_input(const tal_t *ctx,
|
||||
const struct wally_psbt_input *in,
|
||||
const struct wally_tx_input *tx_in)
|
||||
{
|
||||
struct wally_psbt *psbt = create_psbt(NULL, 1, 0);
|
||||
struct wally_psbt *psbt = create_psbt(NULL, 1, 0, 0);
|
||||
size_t byte_len;
|
||||
|
||||
if (wally_tx_add_input(psbt->tx, tx_in) != WALLY_OK)
|
||||
@ -87,7 +87,7 @@ static const u8 *linearize_output(const tal_t *ctx,
|
||||
const struct wally_psbt_output *out,
|
||||
const struct wally_tx_output *tx_out)
|
||||
{
|
||||
struct wally_psbt *psbt = create_psbt(NULL, 1, 1);
|
||||
struct wally_psbt *psbt = create_psbt(NULL, 1, 1, 0);
|
||||
size_t byte_len;
|
||||
struct bitcoin_txid txid;
|
||||
|
||||
|
@ -127,7 +127,7 @@ int main(int argc, const char *argv[])
|
||||
chainparams = chainparams_for_network("bitcoin");
|
||||
|
||||
/* Create two psbts! */
|
||||
end = create_psbt(tmpctx, 1, 1);
|
||||
end = create_psbt(tmpctx, 1, 1, 0);
|
||||
if (wally_psbt_clone_alloc(end, flags, &start) != WALLY_OK)
|
||||
abort();
|
||||
diff_count(start, end, 0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user