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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2026-01-14 09:22:09 +10:30
parent 0269d0c0c9
commit 29465f5240

View File

@@ -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);
}