diff options
| author | Andrew Chow <[email protected]> | 2019-12-03 19:06:15 -0500 |
|---|---|---|
| committer | Andrew Chow <[email protected]> | 2020-01-30 14:44:22 -0500 |
| commit | d67055e00dd90f504384e5c3f229fc95306d5aac (patch) | |
| tree | 1b6ff06857f4c26191e4499f766a934e0f3efaa1 /src/wallet/scriptpubkeyman.cpp | |
| parent | Set fDecryptionThoroughlyChecked based on whether crypted key checksums are v... (diff) | |
| download | discoin-d67055e00dd90f504384e5c3f229fc95306d5aac.tar.xz discoin-d67055e00dd90f504384e5c3f229fc95306d5aac.zip | |
Upgrade or rewrite encrypted key checksums
If fDecryptionThoroughlyChecked is false, after a key has been checked,
write (or rewrite) its checksum. This serves to upgrade wallets
and correct those which have the checksum corrupted but not the key.
Diffstat (limited to 'src/wallet/scriptpubkeyman.cpp')
| -rw-r--r-- | src/wallet/scriptpubkeyman.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp index 6d65d6f69..fba2bf731 100644 --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -210,6 +210,7 @@ bool LegacyScriptPubKeyMan::CheckDecryptionKey(const CKeyingMaterial& master_key bool keyPass = mapCryptedKeys.empty(); // Always pass when there are no encrypted keys bool keyFail = false; CryptedKeyMap::const_iterator mi = mapCryptedKeys.begin(); + WalletBatch batch(m_storage.GetDatabase()); for (; mi != mapCryptedKeys.end(); ++mi) { const CPubKey &vchPubKey = (*mi).second.first; @@ -223,6 +224,10 @@ bool LegacyScriptPubKeyMan::CheckDecryptionKey(const CKeyingMaterial& master_key keyPass = true; if (fDecryptionThoroughlyChecked) break; + else { + // Rewrite these encrypted keys with checksums + batch.WriteCryptedKey(vchPubKey, vchCryptedSecret, mapKeyMetadata[vchPubKey.GetID()]); + } } if (keyPass && keyFail) { |