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

Function new_psbt

bitcoin/psbt.c:47–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47struct wally_psbt *new_psbt(const tal_t *ctx, const struct wally_tx *wtx)
48{
49 struct wally_psbt *psbt;
50 int wally_err;
51
52 psbt = create_psbt(ctx, wtx->num_inputs, wtx->num_outputs, wtx->locktime);
53
54 tal_wally_start();
55
56 /* locktime and modifiable flags are set in create_psbt */
57 wally_psbt_set_tx_version(psbt, wtx->version);
58
59 for (size_t i = 0; i < wtx->num_inputs; i++) {
60 wally_err = wally_psbt_add_tx_input_at(psbt, i, 0, &wtx->inputs[i]);
61 assert(wally_err == WALLY_OK);
62
63 /* add these scripts + witnesses to the psbt */
64 if (wtx->inputs[i].script) {
65 wally_err =
66 wally_psbt_input_set_final_scriptsig(&psbt->inputs[i],
67 wtx->inputs[i].script,
68 wtx->inputs[i].script_len);
69 assert(wally_err == WALLY_OK);
70 }
71 if (wtx->inputs[i].witness) {
72 wally_err =
73 wally_psbt_input_set_final_witness(&psbt->inputs[i],
74 wtx->inputs[i].witness);
75 assert(wally_err == WALLY_OK);
76 }
77 }
78
79 for (size_t i = 0; i < wtx->num_outputs; i++) {
80 wally_psbt_add_tx_output_at(psbt, i, 0, &wtx->outputs[i]);
81 }
82
83 tal_wally_end(psbt);
84 return psbt;
85}
86
87struct wally_psbt *combine_psbt(const tal_t *ctx,
88 const struct wally_psbt *psbt0,

Callers 4

bitcoin_txFunction · 0.85
pull_bitcoin_txFunction · 0.85
txwatch_informFunction · 0.85
replay_blockFunction · 0.85

Calls 3

create_psbtFunction · 0.85
tal_wally_startFunction · 0.85
tal_wally_endFunction · 0.85

Tested by

no test coverage detected