mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Merge #13723: PSBT key path cleanups
917353c8b0Make SignPSBTInput operate on a private SignatureData object (Pieter Wuille)cad5dd2368Pass HD path data through SignatureData (Pieter Wuille)03a99586a3Implement key origin lookup in CWallet (Pieter Wuille)3b01efa0d1[MOVEONLY] Move ParseHDKeypath to utilstrencodings (Pieter Wuille)81e1dd5ce1Generalize PublicOnlySigningProvider into HidingSigningProvider (Pieter Wuille)84f1f1bfdfMake SigningProvider expose key origin information (Pieter Wuille)611ab307fbIntroduce KeyOriginInfo for fingerprint + path (Pieter Wuille) Pull request description: This PR adds "key origin" (master fingeprint + key path) information to what is exposed from `SigningProvider`s, allowing this information to be used by the generic PSBT code instead of having the RPC pull it directly from the wallet. This is also a preparation to having PSBT interact with output descriptors, which can then directly expose key origin information for the scripts they generate. Tree-SHA512: c718382ba8ba2d6fc9a32c062bd4cff08b6f39b133838aa03115c39aeca0f654c7cc3ec72d87005bf8306e550824cd8eb9d60f0bd41784a3e22e17b2afcfe833
This commit is contained in:
@@ -4469,3 +4469,29 @@ std::vector<OutputGroup> CWallet::GroupOutputs(const std::vector<COutput>& outpu
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
bool CWallet::GetKeyOrigin(const CKeyID& keyID, KeyOriginInfo& info) const
|
||||
{
|
||||
CKeyMetadata meta;
|
||||
{
|
||||
LOCK(cs_wallet);
|
||||
auto it = mapKeyMetadata.find(keyID);
|
||||
if (it != mapKeyMetadata.end()) {
|
||||
meta = it->second;
|
||||
}
|
||||
}
|
||||
if (!meta.hdKeypath.empty()) {
|
||||
if (!ParseHDKeypath(meta.hdKeypath, info.path)) return false;
|
||||
// Get the proper master key id
|
||||
CKey key;
|
||||
GetKey(meta.hd_seed_id, key);
|
||||
CExtKey masterKey;
|
||||
masterKey.SetSeed(key.begin(), key.size());
|
||||
// Compute identifier
|
||||
CKeyID masterid = masterKey.key.GetPubKey().GetID();
|
||||
std::copy(masterid.begin(), masterid.begin() + 4, info.fingerprint);
|
||||
} else { // Single pubkeys get the master fingerprint of themselves
|
||||
std::copy(keyID.begin(), keyID.begin() + 4, info.fingerprint);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user