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

Function clone_bitcoin_tx

bitcoin/tx.c:581–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

579}
580
581struct bitcoin_tx *clone_bitcoin_tx(const tal_t *ctx,
582 const struct bitcoin_tx *tx)
583{
584 struct bitcoin_tx *newtx;
585
586 if (taken(tx))
587 return cast_const(struct bitcoin_tx *, tal_steal(ctx, tx));
588
589 newtx = tal(ctx, struct bitcoin_tx);
590
591 newtx->chainparams = tx->chainparams;
592
593 tal_wally_start();
594 if (wally_tx_clone_alloc(tx->wtx, 0, &newtx->wtx) != WALLY_OK)
595 newtx->wtx = NULL;
596 tal_wally_end_onto(newtx, newtx->wtx, struct wally_tx);
597 if (!newtx->wtx)
598 return tal_free(newtx);
599
600 newtx->psbt = clone_psbt(newtx, tx->psbt);
601 tal_add_destructor(newtx, bitcoin_tx_destroy);
602 return newtx;
603}
604
605static struct wally_tx *pull_wtx(const tal_t *ctx,
606 const u8 **cursor,

Callers 10

handle_peer_commit_sigFunction · 0.85
broadcast_tx_Function · 0.85
sign_last_txFunction · 0.85
txwatch_informFunction · 0.85
replay_watch_txFunction · 0.85
peer_got_commitsigFunction · 0.85
handle_update_inflightFunction · 0.85

Calls 4

takenFunction · 0.85
tal_wally_startFunction · 0.85
tal_freeFunction · 0.85
clone_psbtFunction · 0.85

Tested by

no test coverage detected