| 819 | return witness; |
| 820 | } |
| 821 | u8 *bitcoin_wscript_htlc_tx(const tal_t *ctx, |
| 822 | u16 to_self_delay, |
| 823 | const struct pubkey *revocation_pubkey, |
| 824 | const struct pubkey *local_delayedkey) |
| 825 | { |
| 826 | u8 *script = tal_arr(ctx, u8, 0); |
| 827 | |
| 828 | /* BOLT #3: |
| 829 | * |
| 830 | * The witness script for the output is: |
| 831 | * |
| 832 | * OP_IF |
| 833 | * # Penalty transaction |
| 834 | * <revocationpubkey> |
| 835 | * OP_ELSE |
| 836 | * `to_self_delay` |
| 837 | * OP_CHECKSEQUENCEVERIFY |
| 838 | * OP_DROP |
| 839 | * <local_delayedpubkey> |
| 840 | * OP_ENDIF |
| 841 | * OP_CHECKSIG |
| 842 | */ |
| 843 | add_op(&script, OP_IF); |
| 844 | add_push_key(&script, revocation_pubkey); |
| 845 | add_op(&script, OP_ELSE); |
| 846 | add_number(&script, to_self_delay); |
| 847 | add_op(&script, OP_CHECKSEQUENCEVERIFY); |
| 848 | add_op(&script, OP_DROP); |
| 849 | add_push_key(&script, local_delayedkey); |
| 850 | add_op(&script, OP_ENDIF); |
| 851 | add_op(&script, OP_CHECKSIG); |
| 852 | |
| 853 | return script; |
| 854 | } |
| 855 | |
| 856 | u8 *bitcoin_wscript_anchor(const tal_t *ctx, |
| 857 | const struct pubkey *funding_pubkey) |
no test coverage detected