Skip to content

Commit

Permalink
partial merge bitcoin#26532: wallet: bugfix, invalid crypted key "che…
Browse files Browse the repository at this point in the history
…cksum_valid" set

backports cc5a5e8 only

```
wallet: bugfix, invalid crypted key "checksum_valid" set

At wallet load time, we set the crypted key "checksum_valid" variable always to false.
Which, on every wallet decryption call, forces the process to re-write the entire ckeys to db when
it's not needed.
```
  • Loading branch information
furszy authored and UdjinM6 committed Dec 10, 2023
1 parent 3c516ee commit d7bae33
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wallet/walletdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ ReadKeyValue(CWallet* pwallet, CDataStream& ssKey, CDataStream& ssValue,
if (!ssValue.eof()) {
uint256 checksum;
ssValue >> checksum;
if ((checksum_valid = Hash(vchPrivKey) != checksum)) {
if (!(checksum_valid = Hash(vchPrivKey) == checksum)) {
strErr = "Error reading wallet database: Crypted key corrupt";
return false;
}
Expand Down

0 comments on commit d7bae33

Please sign in to comment.