| 251 | } |
| 252 | |
| 253 | u8 **bitcoin_witness_p2wpkh(const tal_t *ctx, |
| 254 | const struct bitcoin_signature *sig, |
| 255 | const struct pubkey *key) |
| 256 | { |
| 257 | u8 **witness; |
| 258 | |
| 259 | /* BIP141: The witness must consist of exactly 2 items (≤ 520 |
| 260 | * bytes each). The first one a signature, and the second one |
| 261 | * a public key. */ |
| 262 | witness = tal_arr(ctx, u8 *, 2); |
| 263 | witness[0] = stack_sig(witness, sig); |
| 264 | witness[1] = stack_key(witness, key); |
| 265 | return witness; |
| 266 | } |
| 267 | |
| 268 | /* Create an output script for a 32-byte witness. */ |
| 269 | u8 *scriptpubkey_p2wsh(const tal_t *ctx, const u8 *witnessscript) |