Implement a function to add KeyOriginInfo to a wallet
This commit is contained in:
parent
eab63bc264
commit
3d235dff5d
2 changed files with 13 additions and 0 deletions
|
@ -4550,3 +4550,13 @@ bool CWallet::GetKeyOrigin(const CKeyID& keyID, KeyOriginInfo& info) const
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CWallet::AddKeyOrigin(const CPubKey& pubkey, const KeyOriginInfo& info)
|
||||||
|
{
|
||||||
|
LOCK(cs_wallet);
|
||||||
|
std::copy(info.fingerprint, info.fingerprint + 4, mapKeyMetadata[pubkey.GetID()].key_origin.fingerprint);
|
||||||
|
mapKeyMetadata[pubkey.GetID()].key_origin.path = info.path;
|
||||||
|
mapKeyMetadata[pubkey.GetID()].has_key_origin = true;
|
||||||
|
mapKeyMetadata[pubkey.GetID()].hdKeypath = WriteHDKeypath(info.path);
|
||||||
|
return WriteKeyMetadata(mapKeyMetadata[pubkey.GetID()], pubkey, true);
|
||||||
|
}
|
||||||
|
|
|
@ -1219,6 +1219,9 @@ public:
|
||||||
|
|
||||||
/** Implement lookup of key origin information through wallet key metadata. */
|
/** Implement lookup of key origin information through wallet key metadata. */
|
||||||
bool GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const override;
|
bool GetKeyOrigin(const CKeyID& keyid, KeyOriginInfo& info) const override;
|
||||||
|
|
||||||
|
/** Add a KeyOriginInfo to the wallet */
|
||||||
|
bool AddKeyOrigin(const CPubKey& pubkey, const KeyOriginInfo& info);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A key allocated from the key pool. */
|
/** A key allocated from the key pool. */
|
||||||
|
|
Loading…
Reference in a new issue