MCPcopy Create free account
hub / github.com/ElementsProject/lightning / bitcoin_wscript_htlc_tx

Function bitcoin_wscript_htlc_tx

bitcoin/script.c:821–854  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

819 return witness;
820}
821u8 *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
856u8 *bitcoin_wscript_anchor(const tal_t *ctx,
857 const struct pubkey *funding_pubkey)

Callers 3

resolve_htlc_txFunction · 0.85
steal_htlc_txFunction · 0.85
htlc_txFunction · 0.85

Calls 3

add_opFunction · 0.85
add_push_keyFunction · 0.85
add_numberFunction · 0.85

Tested by

no test coverage detected