bool CBasicKeyStore::AddKey(const CKey& key)
{
bool fCompressed = false;
- CSecret secret = key.GetSecret(fCompressed);
+ auto secret = key.GetSecret(fCompressed);
{
LOCK(cs_KeyStore);
mapKeys[key.GetPubKey().GetID()] = { secret, fCompressed };
{
{
LOCK(cs_KeyStore);
- ScriptMap::const_iterator mi = mapScripts.find(hash);
+ auto mi = mapScripts.find(hash);
if (mi != mapScripts.end())
{
redeemScriptOut = (*mi).second;
CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin();
for (; mi != mapCryptedKeys.end(); ++mi)
{
- const CPubKey &vchPubKey = (*mi).second.first;
- const std::vector<unsigned char> &vchCryptedSecret = (*mi).second.second;
+ const auto &vchPubKey = (*mi).second.first;
+ const auto &vchCryptedSecret = (*mi).second.second;
CSecret vchSecret;
if(!DecryptSecret(vMasterKeyIn, vchCryptedSecret, vchPubKey.GetHash(), vchSecret))
return false;
return false;
std::vector<unsigned char> vchCryptedSecret;
- CPubKey vchPubKey = key.GetPubKey();
+ auto vchPubKey = key.GetPubKey();
bool fCompressed;
if (!EncryptSecret(vMasterKey, key.GetSecret(fCompressed), vchPubKey.GetHash(), vchCryptedSecret))
return false;
if (!IsCrypted())
return CBasicKeyStore::CreatePrivKey(pubKeyVariant, R, privKey);
- for (CryptedMalleableKeyMap::const_iterator mi = mapCryptedMalleableKeys.begin(); mi != mapCryptedMalleableKeys.end(); mi++)
+ for (auto mi = mapCryptedMalleableKeys.begin(); mi != mapCryptedMalleableKeys.end(); mi++)
{
if (mi->first.CheckKeyVariant(R, pubKeyVariant))
{
LOCK(cs_KeyStore);
if (!IsCrypted())
return CBasicKeyStore::GetMalleableKey(keyView, mKey);
- CryptedMalleableKeyMap::const_iterator mi = mapCryptedMalleableKeys.find(keyView);
+ auto mi = mapCryptedMalleableKeys.find(keyView);
if (mi != mapCryptedMalleableKeys.end())
{
const CPubKey H = keyView.GetMalleablePubKey().GetH();
if (!IsCrypted())
return CBasicKeyStore::GetKey(address, keyOut);
- CryptedKeyMap::const_iterator mi = mapCryptedKeys.find(address);
+ auto mi = mapCryptedKeys.find(address);
if (mi != mapCryptedKeys.end())
{
const CPubKey &vchPubKey = (*mi).second.first;
if (!IsCrypted())
return CKeyStore::GetPubKey(address, vchPubKeyOut);
- CryptedKeyMap::const_iterator mi = mapCryptedKeys.find(address);
+ auto mi = mapCryptedKeys.find(address);
if (mi != mapCryptedKeys.end())
{
vchPubKeyOut = (*mi).second.first;
CKey key;
if (!key.SetSecret(mKey.second.first, mKey.second.second))
return false;
- const CPubKey vchPubKey = key.GetPubKey();
+ const auto vchPubKey = key.GetPubKey();
std::vector<unsigned char> vchCryptedSecret;
bool fCompressed;
if (!EncryptSecret(vMasterKeyIn, key.GetSecret(fCompressed), vchPubKey.GetHash(), vchCryptedSecret))
for(auto& mKey : mapMalleableKeys)
{
- const CPubKey vchPubKeyH = mKey.first.GetMalleablePubKey().GetH();
+ const auto vchPubKeyH = mKey.first.GetMalleablePubKey().GetH();
std::vector<unsigned char> vchCryptedSecretH;
if (!EncryptSecret(vMasterKeyIn, mKey.second, vchPubKeyH.GetHash(), vchCryptedSecretH))
return false;
if (!IsCrypted())
return false;
- CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin();
+ auto mi = mapCryptedKeys.begin();
for (; mi != mapCryptedKeys.end(); ++mi)
{
- const CPubKey &vchPubKey = (*mi).second.first;
- const std::vector<unsigned char> &vchCryptedSecret = (*mi).second.second;
+ const auto &vchPubKey = (*mi).second.first;
+ const auto &vchCryptedSecret = (*mi).second.second;
CSecret vchSecret;
if(!DecryptSecret(vMasterKeyIn, vchCryptedSecret, vchPubKey.GetHash(), vchSecret))
return false;
mapCryptedKeys.clear();
- CryptedMalleableKeyMap::const_iterator mi2 = mapCryptedMalleableKeys.begin();
+ auto mi2 = mapCryptedMalleableKeys.begin();
for(; mi2 != mapCryptedMalleableKeys.end(); ++mi2)
{
- const CPubKey vchPubKeyH = mi2->first.GetMalleablePubKey().GetH();
+ const auto vchPubKeyH = mi2->first.GetMalleablePubKey().GetH();
CSecret vchSecretH;
if(!DecryptSecret(vMasterKeyIn, mi2->second, vchPubKeyH.GetHash(), vchSecretH))