Skip to content

Commit a73b568

Browse files
committed
wallet: also search taproot pubkeys in FillPSBT
When filling a PSBT, we search the listed pubkeys in order to determine whether the current DescriptorScriptPubKeyMan could sign the transaction even if it is not watching the scripts. With Taproot, the taproot pubkeys need to be searched as well.
1 parent 6cff827 commit a73b568

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/wallet/scriptpubkeyman.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,6 +2180,19 @@ TransactionError DescriptorScriptPubKeyMan::FillPSBT(PartiallySignedTransaction&
21802180
*keys = Merge(*keys, *pk_keys);
21812181
}
21822182
}
2183+
for (const auto& pk_pair : input.m_tap_bip32_paths) {
2184+
const XOnlyPubKey& pubkey = pk_pair.first;
2185+
for (unsigned char prefix : {0x02, 0x03}) {
2186+
unsigned char b[33] = {prefix};
2187+
std::copy(pubkey.begin(), pubkey.end(), b + 1);
2188+
CPubKey fullpubkey;
2189+
fullpubkey.Set(b, b + 33);
2190+
std::unique_ptr<FlatSigningProvider> pk_keys = GetSigningProvider(fullpubkey);
2191+
if (pk_keys) {
2192+
*keys = Merge(*keys, *pk_keys);
2193+
}
2194+
}
2195+
}
21832196
}
21842197

21852198
SignPSBTInput(HidingSigningProvider(keys.get(), !sign, !bip32derivs), psbtx, i, &txdata, sighash_type, nullptr, finalize);

0 commit comments

Comments
 (0)