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

Function fromwire_wally_tx_input

bitcoin/tx_parts.c:126–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126static struct wally_tx_input *fromwire_wally_tx_input(const tal_t *ctx,
127 const u8 **cursor,
128 size_t *max)
129{
130 struct wally_tx_input *in;
131 struct bitcoin_txid txid;
132 u32 index, sequence;
133 u8 *script;
134 struct wally_tx_witness_stack *ws;
135 int ret;
136
137 fromwire_bitcoin_txid(cursor, max, &txid);
138 index = fromwire_u32(cursor, max);
139 sequence = fromwire_u32(cursor, max);
140 script = fromwire_tal_arrn(tmpctx,
141 cursor, max, fromwire_u32(cursor, max));
142 /* libwally doesn't like non-NULL ptrs with zero lengths. */
143 if (tal_bytelen(script) == 0)
144 script = tal_free(script);
145 ws = fromwire_wally_tx_witness_stack(tmpctx, cursor, max);
146
147 tal_wally_start();
148 if (is_elements(chainparams)) {
149 u8 *blinding_nonce, *entropy, *issuance_amount,
150 *inflation_keys, *issuance_amount_rangeproof,
151 *inflation_keys_rangeproof;
152 struct wally_tx_witness_stack *pegin_witness;
153
154 blinding_nonce = fromwire_tal_arrn(tmpctx,
155 cursor, max,
156 fromwire_u32(cursor, max));
157 entropy = fromwire_tal_arrn(tmpctx,
158 cursor, max,
159 fromwire_u32(cursor, max));
160 issuance_amount = fromwire_tal_arrn(tmpctx,
161 cursor, max,
162 fromwire_u32(cursor, max));
163 inflation_keys = fromwire_tal_arrn(tmpctx,
164 cursor, max,
165 fromwire_u32(cursor, max));
166 issuance_amount_rangeproof = fromwire_tal_arrn(tmpctx,
167 cursor, max,
168 fromwire_u32(cursor, max));
169 inflation_keys_rangeproof = fromwire_tal_arrn(tmpctx,
170 cursor, max,
171 fromwire_u32(cursor, max));
172 pegin_witness = fromwire_wally_tx_witness_stack(tmpctx,
173 cursor, max);
174 ret = wally_tx_elements_input_init_alloc
175 (txid.shad.sha.u.u8, sizeof(txid.shad.sha.u.u8),
176 index, sequence,
177 script, tal_bytelen(script),
178 ws,
179 blinding_nonce, tal_bytelen(blinding_nonce),
180 entropy, tal_bytelen(entropy),
181 issuance_amount, tal_bytelen(issuance_amount),
182 inflation_keys, tal_bytelen(inflation_keys),
183 issuance_amount_rangeproof,

Callers 1

fromwire_tx_partsFunction · 0.85

Calls 9

fromwire_bitcoin_txidFunction · 0.85
tal_bytelenFunction · 0.85
tal_freeFunction · 0.85
tal_wally_startFunction · 0.85
is_elementsFunction · 0.85
fromwire_u32Function · 0.50
fromwire_tal_arrnFunction · 0.50
fromwire_failFunction · 0.50

Tested by

no test coverage detected