0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-10 10:52:31 -05:00

Replace LegacyScriptPubKeyMan::vMasterKey with GetDecryptionKey()

This commit is contained in:
Andrew Chow 2019-12-05 18:02:01 -05:00
parent fd9d6eebc1
commit e576b135d6
2 changed files with 2 additions and 4 deletions

View file

@ -594,7 +594,7 @@ bool LegacyScriptPubKeyMan::AddKeyPubKeyInner(const CKey& key, const CPubKey &pu
std::vector<unsigned char> vchCryptedSecret; std::vector<unsigned char> vchCryptedSecret;
CKeyingMaterial vchSecret(key.begin(), key.end()); CKeyingMaterial vchSecret(key.begin(), key.end());
if (!EncryptSecret(vMasterKey, vchSecret, pubkey.GetHash(), vchCryptedSecret)) { if (!EncryptSecret(m_storage.GetEncryptionKey(), vchSecret, pubkey.GetHash(), vchCryptedSecret)) {
return false; return false;
} }
@ -759,7 +759,7 @@ bool LegacyScriptPubKeyMan::GetKey(const CKeyID &address, CKey& keyOut) const
{ {
const CPubKey &vchPubKey = (*mi).second.first; const CPubKey &vchPubKey = (*mi).second.first;
const std::vector<unsigned char> &vchCryptedSecret = (*mi).second.second; const std::vector<unsigned char> &vchCryptedSecret = (*mi).second.second;
return DecryptKey(vMasterKey, vchCryptedSecret, vchPubKey, keyOut); return DecryptKey(m_storage.GetEncryptionKey(), vchCryptedSecret, vchPubKey, keyOut);
} }
return false; return false;
} }
@ -1398,7 +1398,6 @@ LegacyScriptPubKeyMan::LegacyScriptPubKeyMan(CWallet& wallet)
: ScriptPubKeyMan(wallet), : ScriptPubKeyMan(wallet),
m_wallet(wallet), m_wallet(wallet),
cs_wallet(wallet.cs_wallet), cs_wallet(wallet.cs_wallet),
vMasterKey(wallet.vMasterKey),
fUseCrypto(wallet.fUseCrypto), fUseCrypto(wallet.fUseCrypto),
fDecryptionThoroughlyChecked(wallet.fDecryptionThoroughlyChecked) {} fDecryptionThoroughlyChecked(wallet.fDecryptionThoroughlyChecked) {}

View file

@ -412,7 +412,6 @@ public:
template<typename... Params> void WalletLogPrintf(const std::string& fmt, const Params&... parameters) const; template<typename... Params> void WalletLogPrintf(const std::string& fmt, const Params&... parameters) const;
CWallet& m_wallet; CWallet& m_wallet;
CCriticalSection& cs_wallet; CCriticalSection& cs_wallet;
CKeyingMaterial& vMasterKey GUARDED_BY(cs_KeyStore);
std::atomic<bool>& fUseCrypto; std::atomic<bool>& fUseCrypto;
bool& fDecryptionThoroughlyChecked; bool& fDecryptionThoroughlyChecked;
}; };