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

Function bitcoin_wscript_htlc_tx

bitcoin/script.c:905–938  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

903 return witness;
904}
905u8 *bitcoin_wscript_htlc_tx(const tal_t *ctx,
906 u16 to_self_delay,
907 const struct pubkey *revocation_pubkey,
908 const struct pubkey *local_delayedkey)
909{
910 u8 *script = tal_arr(ctx, u8, 0);
911
912 /* BOLT #3:
913 *
914 * The witness script for the output is:
915 *
916 * OP_IF
917 * # Penalty transaction
918 * <revocationpubkey>
919 * OP_ELSE
920 * `to_self_delay`
921 * OP_CHECKSEQUENCEVERIFY
922 * OP_DROP
923 * <local_delayedpubkey>
924 * OP_ENDIF
925 * OP_CHECKSIG
926 */
927 add_op(&script, OP_IF);
928 add_push_key(&script, revocation_pubkey);
929 add_op(&script, OP_ELSE);
930 add_number(&script, to_self_delay);
931 add_op(&script, OP_CHECKSEQUENCEVERIFY);
932 add_op(&script, OP_DROP);
933 add_push_key(&script, local_delayedkey);
934 add_op(&script, OP_ENDIF);
935 add_op(&script, OP_CHECKSIG);
936
937 return script;
938}
939
940u8 *bitcoin_wscript_anchor(const tal_t *ctx,
941 const struct pubkey *funding_pubkey)

Callers 6

resolve_htlc_txFunction · 0.85
steal_htlc_txFunction · 0.85
handle_preimageFunction · 0.85
htlc_success_txFunction · 0.85
htlc_timeout_txFunction · 0.85

Calls 3

add_opFunction · 0.85
add_push_keyFunction · 0.85
add_numberFunction · 0.85

Tested by

no test coverage detected