diff options
author | Andrew Chow <achow101-github@achow101.com> | 2022-05-02 11:30:03 -0400 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2022-06-27 16:47:48 -0400 |
commit | a73b56888a1562d9fe46b7b1d2eea08802d98dfe (patch) | |
tree | db87ce67e05a508241827ee5a5d984ed652c3b07 /src | |
parent | 6cff82722f47b589a6a2cb264bfce20f4d45426a (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/scriptpubkeyman.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp index 8633e7c62c..1fec82a485 100644 --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -2180,6 +2180,19 @@ TransactionError DescriptorScriptPubKeyMan::FillPSBT(PartiallySignedTransaction& *keys = Merge(*keys, *pk_keys); } } + for (const auto& pk_pair : input.m_tap_bip32_paths) { + const XOnlyPubKey& pubkey = pk_pair.first; + for (unsigned char prefix : {0x02, 0x03}) { + unsigned char b[33] = {prefix}; + std::copy(pubkey.begin(), pubkey.end(), b + 1); + CPubKey fullpubkey; + fullpubkey.Set(b, b + 33); + std::unique_ptr<FlatSigningProvider> pk_keys = GetSigningProvider(fullpubkey); + if (pk_keys) { + *keys = Merge(*keys, *pk_keys); + } + } + } } SignPSBTInput(HidingSigningProvider(keys.get(), !sign, !bip32derivs), psbtx, i, &txdata, sighash_type, nullptr, finalize); |