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

Function bitcoin_wscript_anchor

bitcoin/script.c:940–963  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

938}
939
940u8 *bitcoin_wscript_anchor(const tal_t *ctx,
941 const struct pubkey *funding_pubkey)
942{
943 u8 *script = tal_arr(ctx, u8, 0);
944
945 /* BOLT #3:
946 * #### `to_local_anchor` and `to_remote_anchor` Output (option_anchors)
947 *...
948 * <local_funding_pubkey/remote_funding_pubkey> OP_CHECKSIG OP_IFDUP
949 * OP_NOTIF
950 * OP_16 OP_CHECKSEQUENCEVERIFY
951 * OP_ENDIF
952 */
953 add_push_key(&script, funding_pubkey);
954 add_op(&script, OP_CHECKSIG);
955 add_op(&script, OP_IFDUP);
956 add_op(&script, OP_NOTIF);
957 add_number(&script, 16);
958 add_op(&script, OP_CHECKSEQUENCEVERIFY);
959 add_op(&script, OP_ENDIF);
960
961 assert(is_anchor_witness_script(script, tal_bytelen(script)));
962 return script;
963}
964
965bool is_anchor_witness_script(const u8 *script, size_t script_len)
966{

Callers 3

get_anchor_scriptpubkeysFunction · 0.85
create_anchor_detailsFunction · 0.85
tx_add_anchor_outputFunction · 0.85

Calls 5

add_push_keyFunction · 0.85
add_opFunction · 0.85
add_numberFunction · 0.85
is_anchor_witness_scriptFunction · 0.85
tal_bytelenFunction · 0.85

Tested by

no test coverage detected