lightningd: use BIP86 derivation for P2TR in HTLC rebroadcast change outputs

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

View File

@@ -1154,7 +1154,12 @@ static bool consider_onchain_htlc_tx_rebroadcast(struct channel *channel,
if (!amount_sat_eq(change, AMOUNT_SAT(0))) {
/* Append change output. */
struct pubkey final_key;
/* 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);