lightningd: use bip86 derivation for anchor spend change outputs

This commit is contained in:
Sangbida Chaudhuri
2026-01-13 22:52:11 +10:30
committed by Rusty Russell
parent bf43fbb7cc
commit fa96b60113

View File

@@ -276,7 +276,12 @@ static struct wally_psbt *anchor_psbt(const tal_t *ctx,
change = chainparams->dust_limit;
}
bip32_pubkey(ld, &final_key, channel->final_key_idx);
/* Use BIP86 derivation for P2TR if available, otherwise BIP32 */
if (ld->bip86_base) {
bip86_pubkey(ld, &final_key, channel->final_key_idx);
} else {
bip32_pubkey(ld, &final_key, channel->final_key_idx);
}
psbt_append_output(psbt,
scriptpubkey_p2tr(tmpctx, &final_key),
change);