mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-04 00:12:33 +02: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.
Github-Pull: gui#773
Rebased-From: 517c7f9cba
This commit is contained in:
parent
a840dab2a5
commit
d7760e62cc
@ -418,6 +418,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…
Reference in New Issue
Block a user