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

Function bitcoin_redeem_2of2

bitcoin/script.c:138–154  ·  view source on GitHub ↗

tal_count() gives the length of the script. */

Source from the content-addressed store, hash-verified

136
137/* tal_count() gives the length of the script. */
138u8 *bitcoin_redeem_2of2(const tal_t *ctx,
139 const struct pubkey *key1,
140 const struct pubkey *key2)
141{
142 u8 *script = tal_arr(ctx, u8, 0);
143 add_number(&script, 2);
144 if (pubkey_cmp(key1, key2) < 0) {
145 add_push_key(&script, key1);
146 add_push_key(&script, key2);
147 } else {
148 add_push_key(&script, key2);
149 add_push_key(&script, key1);
150 }
151 add_number(&script, 2);
152 add_op(&script, OP_CHECKMULTISIG);
153 return script;
154}
155
156u8 *scriptpubkey_p2sh_hash(const tal_t *ctx, const struct ripemd160 *redeemhash)
157{

Callers 15

mainFunction · 0.85
bitcoin_witness_2of2Function · 0.85
migrate_last_tx_to_psbtFunction · 0.85
commit_txFunction · 0.85
channel_txsFunction · 0.85
mainFunction · 0.85
check_funding_txFunction · 0.85

Calls 4

add_numberFunction · 0.85
pubkey_cmpFunction · 0.85
add_push_keyFunction · 0.85
add_opFunction · 0.85

Tested by 1

mainFunction · 0.68