mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-06 14:19:59 -05:00
gui: Check for private keys disabled before attempting unlock
Before trying to unlock a wallet, first check if it has private keys disabled. If so, there is no need to unlock. Note that such wallets are not expected to occur in typical usage. However bugs in previous versions allowed such wallets to be created, and so we need to handle them.
This commit is contained in:
parent
43704827b4
commit
517c7f9cba
1 changed files with 7 additions and 0 deletions
|
@ -449,6 +449,13 @@ void WalletModel::unsubscribeFromCoreSignals()
|
|||
// WalletModel::UnlockContext implementation
|
||||
WalletModel::UnlockContext WalletModel::requestUnlock()
|
||||
{
|
||||
// Bugs in earlier versions may have resulted in wallets with private keys disabled to become "encrypted"
|
||||
// (encryption keys are present, but not actually doing anything).
|
||||
// To avoid issues with such wallets, check if the wallet has private keys disabled, and if so, return a context
|
||||
// that indicates the wallet is not encrypted.
|
||||
if (m_wallet->privateKeysDisabled()) {
|
||||
return UnlockContext(this, /*valid=*/true, /*relock=*/false);
|
||||
}
|
||||
bool was_locked = getEncryptionStatus() == Locked;
|
||||
if(was_locked)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue