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

Function is_anchor_witness_script

bitcoin/script.c:346–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346bool is_anchor_witness_script(const u8 *script, size_t script_len)
347{
348 size_t len = 34 + 1 + 1 + 1;
349 /* With option_will_fund, the pushbytes can be up to 2 bytes more
350 *
351 * <remote_pubkey> OP_CHECKSIGVERIFY
352 * MAX(1, lease_end - blockheight)
353 * OP_CHECKSEQUENCEVERIFY
354 */
355 if (script_len < len || script_len > len + 2)
356 return false;
357 if (script[0] != OP_PUSHBYTES(33))
358 return false;
359 if (script[34] != OP_CHECKSIGVERIFY)
360 return false;
361 /* FIXME: check for push value */
362 if (script[script_len - 1] != OP_CHECKSEQUENCEVERIFY)
363 return false;
364 return true;
365}
366
367/* Create a witness which spends the 2of2. */
368u8 **bitcoin_witness_2of2(const tal_t *ctx,

Callers 2

anchor_to_remote_redeemFunction · 0.70
psbt_finalizeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected