Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 282 Lines • ▼ Show 20 Lines | if (pwalletdbEncryption) { | ||||
return pwalletdbEncryption->WriteCryptedKey( | return pwalletdbEncryption->WriteCryptedKey( | ||||
vchPubKey, vchCryptedSecret, mapKeyMetadata[vchPubKey.GetID()]); | vchPubKey, vchCryptedSecret, mapKeyMetadata[vchPubKey.GetID()]); | ||||
} | } | ||||
return CWalletDB(*dbw).WriteCryptedKey(vchPubKey, vchCryptedSecret, | return CWalletDB(*dbw).WriteCryptedKey(vchPubKey, vchCryptedSecret, | ||||
mapKeyMetadata[vchPubKey.GetID()]); | mapKeyMetadata[vchPubKey.GetID()]); | ||||
} | } | ||||
bool CWallet::LoadKeyMetadata(const CTxDestination &keyID, | bool CWallet::LoadKeyMetadata(const CKeyID &keyID, const CKeyMetadata &meta) { | ||||
const CKeyMetadata &meta) { | |||||
// mapKeyMetadata | // mapKeyMetadata | ||||
AssertLockHeld(cs_wallet); | AssertLockHeld(cs_wallet); | ||||
UpdateTimeFirstKey(meta.nCreateTime); | UpdateTimeFirstKey(meta.nCreateTime); | ||||
mapKeyMetadata[keyID] = meta; | mapKeyMetadata[keyID] = meta; | ||||
return true; | return true; | ||||
} | } | ||||
bool CWallet::LoadScriptMetadata(const CScriptID &script_id, | |||||
const CKeyMetadata &meta) { | |||||
// m_script_metadata | |||||
AssertLockHeld(cs_wallet); | |||||
UpdateTimeFirstKey(meta.nCreateTime); | |||||
m_script_metadata[script_id] = meta; | |||||
return true; | |||||
} | |||||
bool CWallet::LoadCryptedKey(const CPubKey &vchPubKey, | bool CWallet::LoadCryptedKey(const CPubKey &vchPubKey, | ||||
const std::vector<uint8_t> &vchCryptedSecret) { | const std::vector<uint8_t> &vchCryptedSecret) { | ||||
return CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret); | return CCryptoKeyStore::AddCryptedKey(vchPubKey, vchCryptedSecret); | ||||
} | } | ||||
/** | /** | ||||
* Update wallet first key creation time. This should be called whenever keys | * Update wallet first key creation time. This should be called whenever keys | ||||
* are added to the wallet, with the oldest key creation time. | * are added to the wallet, with the oldest key creation time. | ||||
Show All 36 Lines | bool CWallet::LoadCScript(const CScript &redeemScript) { | ||||
return CCryptoKeyStore::AddCScript(redeemScript); | return CCryptoKeyStore::AddCScript(redeemScript); | ||||
} | } | ||||
bool CWallet::AddWatchOnly(const CScript &dest) { | bool CWallet::AddWatchOnly(const CScript &dest) { | ||||
if (!CCryptoKeyStore::AddWatchOnly(dest)) { | if (!CCryptoKeyStore::AddWatchOnly(dest)) { | ||||
return false; | return false; | ||||
} | } | ||||
const CKeyMetadata &meta = mapKeyMetadata[CScriptID(dest)]; | const CKeyMetadata &meta = m_script_metadata[CScriptID(dest)]; | ||||
UpdateTimeFirstKey(meta.nCreateTime); | UpdateTimeFirstKey(meta.nCreateTime); | ||||
NotifyWatchonlyChanged(true); | NotifyWatchonlyChanged(true); | ||||
return CWalletDB(*dbw).WriteWatchOnly(dest, meta); | return CWalletDB(*dbw).WriteWatchOnly(dest, meta); | ||||
} | } | ||||
bool CWallet::AddWatchOnly(const CScript &dest, int64_t nCreateTime) { | bool CWallet::AddWatchOnly(const CScript &dest, int64_t nCreateTime) { | ||||
mapKeyMetadata[CScriptID(dest)].nCreateTime = nCreateTime; | m_script_metadata[CScriptID(dest)].nCreateTime = nCreateTime; | ||||
return AddWatchOnly(dest); | return AddWatchOnly(dest); | ||||
} | } | ||||
bool CWallet::RemoveWatchOnly(const CScript &dest) { | bool CWallet::RemoveWatchOnly(const CScript &dest) { | ||||
AssertLockHeld(cs_wallet); | AssertLockHeld(cs_wallet); | ||||
if (!CCryptoKeyStore::RemoveWatchOnly(dest)) { | if (!CCryptoKeyStore::RemoveWatchOnly(dest)) { | ||||
return false; | return false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 4,039 Lines • Show Last 20 Lines |