| 344 | } |
| 345 | |
| 346 | bool 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. */ |
| 368 | u8 **bitcoin_witness_2of2(const tal_t *ctx, |
no outgoing calls
no test coverage detected