Skip to content

Commit c6398c6

Browse files
committed
Merge #773: Check for private keys disabled before attempting unlock
517c7f9 gui: Check for private keys disabled before attempting unlock (Andrew Chow) Pull request description: 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. Fixes #772 For some additional context, see #631 ACKs for top commit: hebasto: ACK 517c7f9, I have reviewed the code and it looks OK. BrandonOdiwuor: ACK 517c7f9 Tree-SHA512: c92aa34344d04667b70b059d2aa0a1da999cb7239cd1413f3009781aa82379f309ff9808d7dc91d385e2c8afe2abda3564568e2091ef833b1536ebfcf80f7c3c
2 parents e3c1711 + 517c7f9 commit c6398c6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/qt/walletmodel.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,13 @@ void WalletModel::unsubscribeFromCoreSignals()
448448
// WalletModel::UnlockContext implementation
449449
WalletModel::UnlockContext WalletModel::requestUnlock()
450450
{
451+
// Bugs in earlier versions may have resulted in wallets with private keys disabled to become "encrypted"
452+
// (encryption keys are present, but not actually doing anything).
453+
// To avoid issues with such wallets, check if the wallet has private keys disabled, and if so, return a context
454+
// that indicates the wallet is not encrypted.
455+
if (m_wallet->privateKeysDisabled()) {
456+
return UnlockContext(this, /*valid=*/true, /*relock=*/false);
457+
}
451458
bool was_locked = getEncryptionStatus() == Locked;
452459
if(was_locked)
453460
{

0 commit comments

Comments
 (0)