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

Function bitcoin_witness_htlc_timeout_tx

bitcoin/script.c:873–887  ·  view source on GitHub ↗

BOLT #3: * * ## HTLC-Timeout and HTLC-Success Transactions * *... * * `txin[0]` witness stack: `0 ` for HTLC-success, `0 <>` for HTLC-timeout */

Source from the content-addressed store, hash-verified

871 * * `txin[0]` witness stack: `0 <remotehtlcsig> <localhtlcsig> <payment_preimage>` for HTLC-success, `0 <remotehtlcsig> <localhtlcsig> <>` for HTLC-timeout
872 */
873u8 **bitcoin_witness_htlc_timeout_tx(const tal_t *ctx,
874 const struct bitcoin_signature *localhtlcsig,
875 const struct bitcoin_signature *remotehtlcsig,
876 const u8 *wscript)
877{
878 u8 **witness = tal_arr(ctx, u8 *, 5);
879
880 witness[0] = stack_number(witness, 0);
881 witness[1] = stack_sig(witness, remotehtlcsig);
882 witness[2] = stack_sig(witness, localhtlcsig);
883 witness[3] = stack_number(witness, 0);
884 witness[4] = tal_dup_talarr(witness, u8, wscript);
885
886 return witness;
887}
888
889u8 **bitcoin_witness_htlc_success_tx(const tal_t *ctx,
890 const struct bitcoin_signature *localhtlcsig,

Callers 3

mainFunction · 0.85

Calls 2

stack_numberFunction · 0.85
stack_sigFunction · 0.85

Tested by

no test coverage detected