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

Function psbt_has_required_fields

common/psbt_open.c:397–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

395}
396
397bool psbt_has_required_fields(struct wally_psbt *psbt)
398{
399 u64 serial_id;
400 for (size_t i = 0; i < psbt->num_inputs; i++) {
401 struct wally_psbt_input *input = &psbt->inputs[i];
402
403 if (!psbt_get_serial_id(&input->unknowns, &serial_id))
404 return false;
405
406 /* Required because we send the full tx over the wire now */
407 if (!input->utxo)
408 return false;
409
410 /* If is P2SH, redeemscript must be present */
411 assert(psbt->tx->inputs[i].index < input->utxo->num_outputs);
412 const u8 *outscript =
413 wally_tx_output_get_script(tmpctx,
414 &input->utxo->outputs[psbt->tx->inputs[i].index]);
415 if (is_p2sh(outscript, NULL) && input->redeem_script_len == 0)
416 return false;
417
418 }
419
420 for (size_t i = 0; i < psbt->num_outputs; i++) {
421 if (!psbt_get_serial_id(&psbt->outputs[i].unknowns, &serial_id))
422 return false;
423 }
424
425 return true;
426}
427
428bool psbt_side_finalized(const struct wally_psbt *psbt, enum tx_role role)
429{

Calls 3

psbt_get_serial_idFunction · 0.85
is_p2shFunction · 0.50

Tested by

no test coverage detected