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

Function bitcoin_witness_htlc_timeout_tx

bitcoin/script.c:789–803  ·  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

787 * * `txin[0]` witness stack: `0 <remotehtlcsig> <localhtlcsig> <payment_preimage>` for HTLC-success, `0 <remotehtlcsig> <localhtlcsig> <>` for HTLC-timeout
788 */
789u8 **bitcoin_witness_htlc_timeout_tx(const tal_t *ctx,
790 const struct bitcoin_signature *localhtlcsig,
791 const struct bitcoin_signature *remotehtlcsig,
792 const u8 *wscript)
793{
794 u8 **witness = tal_arr(ctx, u8 *, 5);
795
796 witness[0] = stack_number(witness, 0);
797 witness[1] = stack_sig(witness, remotehtlcsig);
798 witness[2] = stack_sig(witness, localhtlcsig);
799 witness[3] = stack_number(witness, 0);
800 witness[4] = tal_dup_talarr(witness, u8, wscript);
801
802 return witness;
803}
804
805u8 **bitcoin_witness_htlc_success_tx(const tal_t *ctx,
806 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