From 29465f5240c8f9fb77e1d10a83efad106bf85852 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 14 Jan 2026 09:22:09 +1030 Subject: [PATCH] wallet: use correct derivation for elements when using mnemonic hsm_secret. Even though we don't do taproot addresses on elements yet, use the same scheme for simplicity and for future when we *do* do taproot. Signed-off-by: Rusty Russell --- wallet/reservation.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/wallet/reservation.c b/wallet/reservation.c index dd1bebb29..b31870a66 100644 --- a/wallet/reservation.c +++ b/wallet/reservation.c @@ -359,7 +359,6 @@ static struct command_result *finish_psbt(struct command *cmd, /* Should we add a change output? (Iff it can pay for itself!) */ change = change_amount(change, feerate_per_kw, weight); if (amount_sat_greater(change, AMOUNT_SAT(0))) { - struct pubkey pubkey; s64 keyidx; u8 *b32script; enum addrtype type; @@ -378,8 +377,7 @@ static struct command_result *finish_psbt(struct command *cmd, " Keys exhausted."); if (chainparams->is_elements) { - bip32_pubkey(cmd->ld, &pubkey, keyidx); - b32script = scriptpubkey_p2wpkh(tmpctx, &pubkey); + b32script = p2wpkh_for_keyidx(tmpctx, cmd->ld, keyidx); } else { b32script = p2tr_for_keyidx(tmpctx, cmd->ld, keyidx); } @@ -658,7 +656,6 @@ static struct command_result *json_addpsbtoutput(struct command *cmd, u32 *locktime; ssize_t outnum; u32 weight; - struct pubkey pubkey; s64 keyidx; const u8 *b32script; bool *add_initiator_serial_ids; @@ -718,8 +715,7 @@ static struct command_result *json_addpsbtoutput(struct command *cmd, " Keys exhausted."); if (chainparams->is_elements) { - bip32_pubkey(cmd->ld, &pubkey, keyidx); - b32script = scriptpubkey_p2wpkh(tmpctx, &pubkey); + b32script = p2wpkh_for_keyidx(tmpctx, cmd->ld, keyidx); } else { b32script = p2tr_for_keyidx(tmpctx, cmd->ld, keyidx); }