lightningd: add p2wpkh script for bip86 base

A bech32 address can be generated from a bip86 base so we should add both script types (p2wpkh, p2tr) to the txfilter for bip86 bases.
This commit is contained in:
Sangbida Chaudhuri
2026-01-13 22:52:12 +10:30
committed by Rusty Russell
parent 4b1f2a079e
commit 4106a212ec

View File

@@ -691,8 +691,11 @@ static void init_txfilter(struct wallet *w,
for (u64 i = 0; i <= bip86_max_index + w->keyscan_gap; i++) {
struct pubkey pubkey;
bip86_pubkey(w->ld, &pubkey, i);
u8 *script = scriptpubkey_p2tr(tmpctx, &pubkey);
txfilter_add_scriptpubkey(filter, take(script));
/* Add both P2TR and P2WPKH scripts since BIP86 keys can be used for both */
u8 *p2tr_script = scriptpubkey_p2tr(tmpctx, &pubkey);
txfilter_add_scriptpubkey(filter, take(p2tr_script));
u8 *p2wpkh_script = scriptpubkey_p2wpkh(tmpctx, &pubkey);
txfilter_add_scriptpubkey(filter, take(p2wpkh_script));
}
}
}