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
| 618 | * OP_CHECKSIG |
| 619 | */ |
| 620 | u8 *bitcoin_wscript_to_local(const tal_t *ctx, u16 to_self_delay, |
| 621 | u32 lease_remaining, |
| 622 | const struct pubkey *revocation_pubkey, |
| 623 | const struct pubkey *local_delayedkey) |
| 624 | { |
| 625 | u8 *script = tal_arr(ctx, u8, 0); |
| 626 | add_op(&script, OP_IF); |
| 627 | add_push_key(&script, revocation_pubkey); |
| 628 | add_op(&script, OP_ELSE); |
| 629 | add_number(&script, max_unsigned(lease_remaining, to_self_delay)); |
| 630 | add_op(&script, OP_CHECKSEQUENCEVERIFY); |
| 631 | add_op(&script, OP_DROP); |
| 632 | add_push_key(&script, local_delayedkey); |
| 633 | add_op(&script, OP_ENDIF); |
| 634 | add_op(&script, OP_CHECKSIG); |
| 635 | return script; |
| 636 | } |
| 637 | |
| 638 | /* BOLT #3: |
| 639 | * |
no test coverage detected