txfilter_add_derkey: track p2tr scripts

This commit is contained in:
Greg Sanders
2023-07-11 01:57:43 +09:30
committed by Rusty Russell
parent fdbb31e4d0
commit 01a79fcd59
2 changed files with 4 additions and 2 deletions

View File

@@ -69,13 +69,15 @@ void txfilter_add_scriptpubkey(struct txfilter *filter, const u8 *script TAKES)
void txfilter_add_derkey(struct txfilter *filter, void txfilter_add_derkey(struct txfilter *filter,
const u8 derkey[PUBKEY_CMPR_LEN]) const u8 derkey[PUBKEY_CMPR_LEN])
{ {
u8 *skp, *p2sh; u8 *skp, *p2sh, *p2tr;
skp = scriptpubkey_p2wpkh_derkey(tmpctx, derkey); skp = scriptpubkey_p2wpkh_derkey(tmpctx, derkey);
p2sh = scriptpubkey_p2sh(tmpctx, skp); p2sh = scriptpubkey_p2sh(tmpctx, skp);
p2tr = scriptpubkey_p2tr_derkey(tmpctx, derkey);
txfilter_add_scriptpubkey(filter, take(skp)); txfilter_add_scriptpubkey(filter, take(skp));
txfilter_add_scriptpubkey(filter, take(p2sh)); txfilter_add_scriptpubkey(filter, take(p2sh));
txfilter_add_scriptpubkey(filter, take(p2tr));
} }

View File

@@ -22,7 +22,7 @@ struct txfilter *txfilter_new(const tal_t *ctx);
* This ensures that we recognize the scriptpubkeys to our keys when * This ensures that we recognize the scriptpubkeys to our keys when
* filtering transactions. If any of the outputs matches the * filtering transactions. If any of the outputs matches the
* scriptpubkey then the transaction is marked as a match. Adds * scriptpubkey then the transaction is marked as a match. Adds
* scriptpubkey for both raw p2wpkh and p2wpkh wrapped in p2sh. * scriptpubkey for taproot, raw p2wpkh and p2wpkh wrapped in p2sh.
*/ */
void txfilter_add_derkey(struct txfilter *filter, void txfilter_add_derkey(struct txfilter *filter,
const u8 derkey[PUBKEY_CMPR_LEN]); const u8 derkey[PUBKEY_CMPR_LEN]);