mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-04 23:04:35 +01:00
bitcoin/script: bitcoin_witness_p2wpkh()
For the wallet code to use for change. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -281,6 +281,21 @@ void bitcoin_witness_p2sh_p2wpkh(const tal_t *ctx,
|
||||
input->witness[1] = stack_key(input->witness, key);
|
||||
}
|
||||
|
||||
u8 **bitcoin_witness_p2wpkh(const tal_t *ctx,
|
||||
const secp256k1_ecdsa_signature *sig,
|
||||
const struct pubkey *key)
|
||||
{
|
||||
u8 **witness;
|
||||
|
||||
/* BIP141: The witness must consist of exactly 2 items (≤ 520
|
||||
* bytes each). The first one a signature, and the second one
|
||||
* a public key. */
|
||||
witness = tal_arr(ctx, u8 *, 2);
|
||||
witness[0] = stack_sig(witness, sig);
|
||||
witness[1] = stack_key(witness, key);
|
||||
return witness;
|
||||
}
|
||||
|
||||
/* Create an output script for a 32-byte witness. */
|
||||
u8 *scriptpubkey_p2wsh(const tal_t *ctx, const u8 *witnessscript)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user