MCPcopy Create free account
hub / github.com/ElementsProject/lightning / bitcoin_tx

Function bitcoin_tx

bitcoin/tx.c:517–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515}
516
517struct bitcoin_tx *bitcoin_tx(const tal_t *ctx,
518 const struct chainparams *chainparams,
519 varint_t input_count, varint_t output_count,
520 u32 nlocktime)
521{
522 struct bitcoin_tx *tx = tal(ctx, struct bitcoin_tx);
523 assert(chainparams);
524
525 /* If we are constructing an elements transaction we need to
526 * explicitly add the fee as an extra output. So allocate one more
527 * than the outputs we need internally. */
528 if (chainparams->is_elements)
529 output_count += 1;
530
531 tal_wally_start();
532 wally_tx_init_alloc(WALLY_TX_VERSION_2, nlocktime, input_count, output_count,
533 &tx->wtx);
534 tal_add_destructor(tx, bitcoin_tx_destroy);
535 tal_wally_end_onto(tx, tx->wtx, struct wally_tx);
536
537 tx->chainparams = chainparams;
538 tx->psbt = new_psbt(tx, tx->wtx);
539
540 return tx;
541}
542
543void bitcoin_tx_finalize(struct bitcoin_tx *tx)
544{

Callers 1

bitcoin_tx_with_psbtFunction · 0.70

Calls 2

tal_wally_startFunction · 0.85
new_psbtFunction · 0.85

Tested by

no test coverage detected