diff options
author | Andrew Chow <achow101-github@achow101.com> | 2018-11-06 09:23:45 -0500 |
---|---|---|
committer | Andrew Chow <achow101-github@achow101.com> | 2019-02-14 17:58:25 -0500 |
commit | 3d235dff5df106070e41e3a99cf9fb847a27e14a (patch) | |
tree | d9484067ce57ec5b8b33c86daf5d105e932c7a27 /src/wallet/wallet.cpp | |
parent | eab63bc264a35cf21738e8535773e3d36524c3fe (diff) | |
download | bitcoin-3d235dff5df106070e41e3a99cf9fb847a27e14a.tar.xz |
Implement a function to add KeyOriginInfo to a wallet
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r-- | src/wallet/wallet.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 399490ea9f..4df4e0981e 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4550,3 +4550,13 @@ bool CWallet::GetKeyOrigin(const CKeyID& keyID, KeyOriginInfo& info) const } 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); +} |