aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/scriptpubkeyman.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-12-03 18:57:51 -0500
committerAndrew Chow <achow101-github@achow101.com>2020-01-30 14:44:22 -0500
commitc9a9ddb4142af0af5f7b1a5ccd13f8e585007089 (patch)
treee6570eabfc96853d638b489427873820cc9cdc9e /src/wallet/scriptpubkeyman.cpp
parenta8334f7ac39532528c5f8bd3b0eea05aa63e8794 (diff)
downloadbitcoin-c9a9ddb4142af0af5f7b1a5ccd13f8e585007089.tar.xz
Set fDecryptionThoroughlyChecked based on whether crypted key checksums are valid
Change fDecryptionThoroughlyChecked to default to true so that it can latch to false when an invalid checksum is seen. Checksums may be invalid if the wallet does not have checksums or if the wallet became corrupted. It is safe to default fDecryptionThoroughlyChecked to true because any existing wallet without a checksum will set it to false. Any new or blank wallet where encrypted keys are added will then set this to true when the first encrypted key is generated by virtue of CheckDecryptionKey doing that during the initial Unlock prior to keys being added.
Diffstat (limited to 'src/wallet/scriptpubkeyman.cpp')
-rw-r--r--src/wallet/scriptpubkeyman.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp
index 4c9d88973e..6d65d6f69d 100644
--- a/src/wallet/scriptpubkeyman.cpp
+++ b/src/wallet/scriptpubkeyman.cpp
@@ -643,8 +643,13 @@ bool LegacyScriptPubKeyMan::AddKeyPubKeyInner(const CKey& key, const CPubKey &pu
return true;
}
-bool LegacyScriptPubKeyMan::LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret)
+bool LegacyScriptPubKeyMan::LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret, bool checksum_valid)
{
+ // Set fDecryptionThoroughlyChecked to false when the checksum is invalid
+ if (!checksum_valid) {
+ fDecryptionThoroughlyChecked = false;
+ }
+
return AddCryptedKeyInner(vchPubKey, vchCryptedSecret);
}