mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
psbt_input_add_pubkey: support taproot
This commit is contained in:
parent
011f3c1e14
commit
0097e2c666
2 changed files with 16 additions and 7 deletions
|
@ -211,7 +211,7 @@ void psbt_rm_output(struct wally_psbt *psbt,
|
|||
}
|
||||
|
||||
void psbt_input_add_pubkey(struct wally_psbt *psbt, size_t in,
|
||||
const struct pubkey *pubkey)
|
||||
const struct pubkey *pubkey, bool is_taproot)
|
||||
{
|
||||
int wally_err;
|
||||
u32 empty_path[1] = {0};
|
||||
|
@ -233,11 +233,20 @@ void psbt_input_add_pubkey(struct wally_psbt *psbt, size_t in,
|
|||
pubkey_to_der(pk_der, pubkey);
|
||||
|
||||
tal_wally_start();
|
||||
wally_err = wally_psbt_input_keypath_add(&psbt->inputs[in],
|
||||
pk_der, sizeof(pk_der),
|
||||
fingerprint, sizeof(fingerprint),
|
||||
empty_path, ARRAY_SIZE(empty_path));
|
||||
assert(wally_err == WALLY_OK);
|
||||
if (is_taproot) {
|
||||
wally_err = wally_psbt_input_taproot_keypath_add(&psbt->inputs[in],
|
||||
pk_der + 1, 32,
|
||||
NULL /* tapleaf_hashes */, 0 /* tapleaf_hashes_len */,
|
||||
fingerprint, sizeof(fingerprint),
|
||||
empty_path, ARRAY_SIZE(empty_path));
|
||||
assert(wally_err == WALLY_OK);
|
||||
} else {
|
||||
wally_err = wally_psbt_input_keypath_add(&psbt->inputs[in],
|
||||
pk_der, sizeof(pk_der),
|
||||
fingerprint, sizeof(fingerprint),
|
||||
empty_path, ARRAY_SIZE(empty_path));
|
||||
assert(wally_err == WALLY_OK);
|
||||
}
|
||||
tal_wally_end(psbt);
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ void psbt_rm_output(struct wally_psbt *psbt,
|
|||
size_t remove_at);
|
||||
|
||||
void psbt_input_add_pubkey(struct wally_psbt *psbt, size_t in,
|
||||
const struct pubkey *pubkey);
|
||||
const struct pubkey *pubkey, bool is_taproot);
|
||||
|
||||
WARN_UNUSED_RESULT bool psbt_input_set_signature(struct wally_psbt *psbt, size_t in,
|
||||
const struct pubkey *pubkey,
|
||||
|
|
Loading…
Add table
Reference in a new issue