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