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

Function scriptpubkey_p2wsh

bitcoin/script.c:269–279  ·  view source on GitHub ↗

Create an output script for a 32-byte witness. */

Source from the content-addressed store, hash-verified

267
268/* Create an output script for a 32-byte witness. */
269u8 *scriptpubkey_p2wsh(const tal_t *ctx, const u8 *witnessscript)
270{
271 struct sha256 h;
272 u8 *script = tal_arr(ctx, u8, 0);
273
274 add_op(&script, OP_0);
275 sha256(&h, witnessscript, tal_count(witnessscript));
276 script_push_bytes(&script, h.u.u8, sizeof(h.u.u8));
277 assert(tal_count(script) == BITCOIN_SCRIPTPUBKEY_P2WSH_LEN);
278 return script;
279}
280
281/* Create an output script for a 20-byte witness. */
282u8 *scriptpubkey_p2wpkh(const tal_t *ctx, const struct pubkey *key)

Callers 15

bitcoin_tx_add_inputFunction · 0.70
get_anchor_scriptpubkeysFunction · 0.50
scriptpubkey_to_remoteFunction · 0.50
handle_our_unilateralFunction · 0.50
handle_their_cheatFunction · 0.50
handle_their_unilateralFunction · 0.50
htlc_timeout_txFunction · 0.50
sign_our_inputsFunction · 0.50
migrate_last_tx_to_psbtFunction · 0.50
add_offered_htlc_outFunction · 0.50

Calls 3

add_opFunction · 0.85
sha256Class · 0.70
script_push_bytesFunction · 0.70

Tested by 1

htlc_timeout_txFunction · 0.40