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

Function bitcoin_tx

bitcoin/tx.c:505–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

503}
504
505struct bitcoin_tx *bitcoin_tx(const tal_t *ctx,
506 const struct chainparams *chainparams,
507 varint_t input_count, varint_t output_count,
508 u32 nlocktime)
509{
510 struct bitcoin_tx *tx = tal(ctx, struct bitcoin_tx);
511 assert(chainparams);
512
513 /* If we are constructing an elements transaction we need to
514 * explicitly add the fee as an extra output. So allocate one more
515 * than the outputs we need internally. */
516 if (chainparams->is_elements)
517 output_count += 1;
518
519 tal_wally_start();
520 wally_tx_init_alloc(WALLY_TX_VERSION_2, nlocktime, input_count, output_count,
521 &tx->wtx);
522 tal_add_destructor(tx, bitcoin_tx_destroy);
523 tal_wally_end_onto(tx, tx->wtx, struct wally_tx);
524
525 tx->chainparams = chainparams;
526 tx->psbt = new_psbt(tx, tx->wtx);
527
528 return tx;
529}
530
531void bitcoin_tx_finalize(struct bitcoin_tx *tx)
532{

Callers 1

bitcoin_tx_with_psbtFunction · 0.70

Calls 2

tal_wally_startFunction · 0.85
new_psbtFunction · 0.70

Tested by

no test coverage detected