Skip to content

Commit

Permalink
walletdb: Check that unencrypted and crypted keys are mutually exclusive
Browse files Browse the repository at this point in the history
  • Loading branch information
achow101 committed Dec 11, 2023
1 parent af3667a commit 1bbbb73
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/wallet/walletdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,11 @@ static DBErrors LoadDescriptorWalletRecords(CWallet* pwallet, DatabaseBatch& bat
});
result = std::max(result, desc_res.m_result);

if (num_ckeys > 0 && num_keys != 0) {
pwallet->WalletLogPrintf("Error: Wallet has both encrypted and unencrypted HD keys\n");
return DBErrors::CORRUPT;
}

// Load the active hd key
if (wallet_xpub && !pwallet->LoadActiveHDPubKey(*wallet_xpub, wallet_key, wallet_crypted_key)) {
pwallet->WalletLogPrintf("Error: Unable to load active hd pubkey\n");
Expand Down

0 comments on commit 1bbbb73

Please sign in to comment.