diff options
| author | Andrew Chow <[email protected]> | 2018-11-06 09:23:39 -0500 |
|---|---|---|
| committer | Andrew Chow <[email protected]> | 2019-02-14 14:00:29 -0500 |
| commit | bac8c676a727b4216ffcf4c430858bb93fda302e (patch) | |
| tree | ed1b8573a9ae38bf3f60b257619107bfe0dab93e /src | |
| parent | Add WriteHDKeypath function and move *HDKeypath to util/bip32.{h,cpp} (diff) | |
| download | discoin-bac8c676a727b4216ffcf4c430858bb93fda302e.tar.xz discoin-bac8c676a727b4216ffcf4c430858bb93fda302e.zip | |
Add a method to CWallet to write just CKeyMetadata
Diffstat (limited to 'src')
| -rw-r--r-- | src/wallet/wallet.cpp | 6 | ||||
| -rw-r--r-- | src/wallet/wallet.h | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 69e8b0835..4c5ac2a82 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -349,6 +349,12 @@ void CWallet::LoadScriptMetadata(const CScriptID& script_id, const CKeyMetadata m_script_metadata[script_id] = meta; } +// Writes a keymetadata for a public key. overwrite specifies whether to overwrite an existing metadata for that key if there exists one. +bool CWallet::WriteKeyMetadata(const CKeyMetadata& meta, const CPubKey& pubkey, const bool overwrite) +{ + return WalletBatch(*database).WriteKeyMetadata(meta, pubkey, overwrite); +} + bool CWallet::LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret) { return CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 5846ac0f3..18bcc9af9 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -776,6 +776,8 @@ public: // Map from Script ID to key metadata (for watch-only keys). std::map<CScriptID, CKeyMetadata> m_script_metadata GUARDED_BY(cs_wallet); + bool WriteKeyMetadata(const CKeyMetadata& meta, const CPubKey& pubkey, bool overwrite); + typedef std::map<unsigned int, CMasterKey> MasterKeyMap; MasterKeyMap mapMasterKeys; unsigned int nMasterKeyMaxID = 0; |