| 938 | } |
| 939 | |
| 940 | u8 *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 | |
| 965 | bool is_anchor_witness_script(const u8 *script, size_t script_len) |
| 966 | { |
no test coverage detected