mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Clear mapKeys before encrypting
Does not change behavior. Needed to make AddCryptedKeyInner() work with SetCrypted() being gone.
This commit is contained in:
parent
14b5efd66f
commit
35f962fcf0
1 changed files with 3 additions and 2 deletions
|
|
@ -245,7 +245,9 @@ bool LegacyScriptPubKeyMan::EncryptKeys(CKeyingMaterial& vMasterKeyIn)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
fUseCrypto = true;
|
fUseCrypto = true;
|
||||||
for (const KeyMap::value_type& mKey : mapKeys)
|
KeyMap keys_to_encrypt;
|
||||||
|
keys_to_encrypt.swap(mapKeys); // Clear mapKeys so AddCryptedKeyInner will succeed.
|
||||||
|
for (const KeyMap::value_type& mKey : keys_to_encrypt)
|
||||||
{
|
{
|
||||||
const CKey &key = mKey.second;
|
const CKey &key = mKey.second;
|
||||||
CPubKey vchPubKey = key.GetPubKey();
|
CPubKey vchPubKey = key.GetPubKey();
|
||||||
|
|
@ -256,7 +258,6 @@ bool LegacyScriptPubKeyMan::EncryptKeys(CKeyingMaterial& vMasterKeyIn)
|
||||||
if (!AddCryptedKey(vchPubKey, vchCryptedSecret))
|
if (!AddCryptedKey(vchPubKey, vchCryptedSecret))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
mapKeys.clear();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue