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

Function scriptpubkey_p2wsh

bitcoin/script.c:268–278  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers 15

get_anchor_scriptpubkeysFunction · 0.85
scriptpubkey_to_remoteFunction · 0.85
handle_our_unilateralFunction · 0.85
handle_their_cheatFunction · 0.85
handle_their_unilateralFunction · 0.85
htlc_timeout_txFunction · 0.85
sign_our_inputsFunction · 0.85
bitcoin_tx_add_inputFunction · 0.85
migrate_last_tx_to_psbtFunction · 0.85
add_offered_htlc_outFunction · 0.85

Calls 3

add_opFunction · 0.85
script_push_bytesFunction · 0.85
sha256Class · 0.70

Tested by 1

htlc_timeout_txFunction · 0.68