BOLT #3: * * This output sends funds back to the owner of this commitment transaction and * thus must be timelocked using `OP_CHECKSEQUENCEVERIFY`. It can be claimed, without delay, * by the other party if they know the revocation private key. The output is a * version-0 P2WSH, with a witness script: * * OP_IF * # Penalty transaction * * OP_ELSE
| 540 | * OP_CHECKSIG |
| 541 | */ |
| 542 | u8 *bitcoin_wscript_to_local(const tal_t *ctx, u16 to_self_delay, |
| 543 | u32 lease_remaining, |
| 544 | const struct pubkey *revocation_pubkey, |
| 545 | const struct pubkey *local_delayedkey) |
| 546 | { |
| 547 | u8 *script = tal_arr(ctx, u8, 0); |
| 548 | add_op(&script, OP_IF); |
| 549 | add_push_key(&script, revocation_pubkey); |
| 550 | add_op(&script, OP_ELSE); |
| 551 | add_number(&script, max_unsigned(lease_remaining, to_self_delay)); |
| 552 | add_op(&script, OP_CHECKSEQUENCEVERIFY); |
| 553 | add_op(&script, OP_DROP); |
| 554 | add_push_key(&script, local_delayedkey); |
| 555 | add_op(&script, OP_ENDIF); |
| 556 | add_op(&script, OP_CHECKSIG); |
| 557 | return script; |
| 558 | } |
| 559 | |
| 560 | /* BOLT #3: |
| 561 | * |
no test coverage detected