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

Function fromwire_wally_tx_input

bitcoin/tx_parts.c:178–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178static struct wally_tx_input *fromwire_wally_tx_input(const tal_t *ctx,
179 const u8 **cursor,
180 size_t *max)
181{
182 struct wally_tx_input *in;
183 struct bitcoin_txid txid;
184 u32 index, sequence;
185 u8 *script;
186 struct wally_tx_witness_stack *ws;
187 int ret;
188
189 fromwire_bitcoin_txid(cursor, max, &txid);
190 index = fromwire_u32(cursor, max);
191 sequence = fromwire_u32(cursor, max);
192 script = fromwire_tal_arrn(tmpctx,
193 cursor, max, fromwire_u32(cursor, max));
194 /* libwally doesn't like non-NULL ptrs with zero lengths. */
195 if (tal_bytelen(script) == 0)
196 script = tal_free(script);
197 ws = fromwire_wally_tx_witness_stack(tmpctx, cursor, max);
198
199 tal_wally_start();
200 if (is_elements(chainparams)) {
201 u8 *blinding_nonce, *entropy, *issuance_amount,
202 *inflation_keys, *issuance_amount_rangeproof,
203 *inflation_keys_rangeproof;
204 struct wally_tx_witness_stack *pegin_witness;
205
206 blinding_nonce = fromwire_tal_arrn(tmpctx,
207 cursor, max,
208 fromwire_u32(cursor, max));
209 entropy = fromwire_tal_arrn(tmpctx,
210 cursor, max,
211 fromwire_u32(cursor, max));
212 issuance_amount = fromwire_tal_arrn(tmpctx,
213 cursor, max,
214 fromwire_u32(cursor, max));
215 inflation_keys = fromwire_tal_arrn(tmpctx,
216 cursor, max,
217 fromwire_u32(cursor, max));
218 issuance_amount_rangeproof = fromwire_tal_arrn(tmpctx,
219 cursor, max,
220 fromwire_u32(cursor, max));
221 inflation_keys_rangeproof = fromwire_tal_arrn(tmpctx,
222 cursor, max,
223 fromwire_u32(cursor, max));
224 pegin_witness = fromwire_wally_tx_witness_stack(tmpctx,
225 cursor, max);
226 ret = wally_tx_elements_input_init_alloc
227 (txid.shad.sha.u.u8, sizeof(txid.shad.sha.u.u8),
228 index, sequence,
229 script, tal_bytelen(script),
230 ws,
231 blinding_nonce, tal_bytelen(blinding_nonce),
232 entropy, tal_bytelen(entropy),
233 issuance_amount, tal_bytelen(issuance_amount),
234 inflation_keys, tal_bytelen(inflation_keys),
235 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