diff --git a/src/keystore.cpp b/src/keystore.cpp index dbbd51c..dc3223a 100644 --- a/src/keystore.cpp +++ b/src/keystore.cpp @@ -93,7 +93,7 @@ bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn) if (!SetCrypted()) return false; - for (const auto& [key, val] : mapCryptedKeys) + for (const auto& [pubKeyHash, val] : mapCryptedKeys) { const CPubKey &vchPubKey = val.first; const std::vector &vchCryptedSecret = val.second; @@ -102,10 +102,10 @@ bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn) return false; if (vchSecret.size() != 32) return false; - CKey key; - key.SetPubKey(vchPubKey); - key.SetSecret(vchSecret); - if (key.GetPubKey() == vchPubKey) + CKey decryptedKey; + decryptedKey.SetPubKey(vchPubKey); + decryptedKey.SetSecret(vchSecret); + if (decryptedKey.GetPubKey() == vchPubKey) break; return false; } diff --git a/src/walletdb.h b/src/walletdb.h index 5e49499..b1b9428 100644 --- a/src/walletdb.h +++ b/src/walletdb.h @@ -98,13 +98,13 @@ public: bool WriteTx(uint256 hash, const CWalletTx& wtx) { nWalletDBUpdated++; - return Write({std::string("tx"), hash}, wtx); + return Write(std::make_pair(std::string("tx"), hash), wtx); } bool EraseTx(uint256 hash) { nWalletDBUpdated++; - return Erase({std::string("tx"), hash}); + return Erase(std::make_pair(std::string("tx"), hash)); } bool WriteKey(const CPubKey& vchPubKey, const CPrivKey& vchPrivKey, const CKeyMetadata &keyMeta) {