tal_count() gives the length of the script. */
| 136 | |
| 137 | /* tal_count() gives the length of the script. */ |
| 138 | u8 *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 | |
| 156 | u8 *scriptpubkey_p2sh_hash(const tal_t *ctx, const struct ripemd160 *redeemhash) |
| 157 | { |