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

Function fromwire_wally_psbt

bitcoin/psbt.c:743–772  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

741}
742
743struct wally_psbt *fromwire_wally_psbt(const tal_t *ctx,
744 const u8 **cursor, size_t *max)
745{
746 struct wally_psbt *psbt;
747 u32 psbt_byte_len;
748 const u8 *psbt_buf;
749
750 psbt_byte_len = fromwire_u32(cursor, max);
751 psbt_buf = fromwire(cursor, max, NULL, psbt_byte_len);
752 if (!psbt_buf || psbt_byte_len == 0)
753 return NULL;
754
755 psbt = psbt_from_bytes(ctx, psbt_buf, psbt_byte_len);
756 if (!psbt)
757 return fromwire_fail(cursor, max);
758
759#if DEVELOPER
760 /* Re-marshall for sanity check! */
761 u8 *tmpbuf = tal_arr(NULL, u8, psbt_byte_len);
762 size_t written;
763 if (wally_psbt_to_bytes(psbt, 0, tmpbuf, psbt_byte_len, &written) != WALLY_OK) {
764 tal_free(tmpbuf);
765 tal_free(psbt);
766 return fromwire_fail(cursor, max);
767 }
768 tal_free(tmpbuf);
769#endif
770
771 return psbt;
772}
773
774/* This only works on a non-final psbt because we're ALL SEGWIT! */
775void psbt_txid(const tal_t *ctx,

Callers 1

fromwire_bitcoin_txFunction · 0.70

Calls 5

psbt_from_bytesFunction · 0.85
tal_freeFunction · 0.85
fromwire_u32Function · 0.50
fromwireFunction · 0.50
fromwire_failFunction · 0.50

Tested by

no test coverage detected