We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 14b5efd commit 35f962fCopy full SHA for 35f962f
src/wallet/scriptpubkeyman.cpp
@@ -245,7 +245,9 @@ bool LegacyScriptPubKeyMan::EncryptKeys(CKeyingMaterial& vMasterKeyIn)
245
return false;
246
247
fUseCrypto = true;
248
- for (const KeyMap::value_type& mKey : mapKeys)
+ KeyMap keys_to_encrypt;
249
+ keys_to_encrypt.swap(mapKeys); // Clear mapKeys so AddCryptedKeyInner will succeed.
250
+ for (const KeyMap::value_type& mKey : keys_to_encrypt)
251
{
252
const CKey &key = mKey.second;
253
CPubKey vchPubKey = key.GetPubKey();
@@ -256,7 +258,6 @@ bool LegacyScriptPubKeyMan::EncryptKeys(CKeyingMaterial& vMasterKeyIn)
256
258
if (!AddCryptedKey(vchPubKey, vchCryptedSecret))
257
259
260
}
- mapKeys.clear();
261
return true;
262
263
0 commit comments