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

Function scriptpubkey_raw_p2tr

bitcoin/script.c:312–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310}
311
312u8 *scriptpubkey_raw_p2tr(const tal_t *ctx, const struct pubkey *output_pubkey)
313{
314 int ok;
315 secp256k1_xonly_pubkey x_key;
316 unsigned char x_key_bytes[32];
317 u8 *script = tal_arr(ctx, u8, 0);
318
319 add_op(&script, OP_1);
320
321 ok = secp256k1_xonly_pubkey_from_pubkey(secp256k1_ctx,
322 &x_key,
323 /* pk_parity */ NULL,
324 &(output_pubkey->pubkey));
325 assert(ok);
326
327 ok = secp256k1_xonly_pubkey_serialize(secp256k1_ctx,
328 x_key_bytes,
329 &x_key);
330 assert(ok);
331
332 script_push_bytes(&script, x_key_bytes, sizeof(x_key_bytes));
333 assert(tal_count(script) == BITCOIN_SCRIPTPUBKEY_P2TR_LEN);
334 return script;
335}
336
337u8 *scriptpubkey_raw_p2tr_derkey(const tal_t *ctx, const u8 output_der[33])
338{

Callers 1

Calls 2

add_opFunction · 0.85
script_push_bytesFunction · 0.85

Tested by

no test coverage detected