diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -831,6 +831,9 @@ // Map from Script ID to key metadata (for watch-only keys). std::map m_script_metadata GUARDED_BY(cs_wallet); + bool WriteKeyMetadata(const CKeyMetadata &meta, const CPubKey &pubkey, + bool overwrite); + typedef std::map MasterKeyMap; MasterKeyMap mapMasterKeys; unsigned int nMasterKeyMaxID = 0; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -419,6 +419,13 @@ 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 &vchCryptedSecret) { return CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret);