WalletModel::UnlockContext implementation
| 426 | |
| 427 | // WalletModel::UnlockContext implementation |
| 428 | WalletModel::UnlockContext WalletModel::requestUnlock() |
| 429 | { |
| 430 | // Bugs in earlier versions may have resulted in wallets with private keys disabled to become "encrypted" |
| 431 | // (encryption keys are present, but not actually doing anything). |
| 432 | // To avoid issues with such wallets, check if the wallet has private keys disabled, and if so, return a context |
| 433 | // that indicates the wallet is not encrypted. |
| 434 | if (m_wallet->privateKeysDisabled()) { |
| 435 | return UnlockContext(this, /*valid=*/true, /*relock=*/false); |
| 436 | } |
| 437 | bool was_locked = getEncryptionStatus() == Locked; |
| 438 | if(was_locked) |
| 439 | { |
| 440 | // Request UI to unlock wallet |
| 441 | Q_EMIT requireUnlock(); |
| 442 | } |
| 443 | // If wallet is still locked, unlock was failed or cancelled, mark context as invalid |
| 444 | bool valid = getEncryptionStatus() != Locked; |
| 445 | |
| 446 | return UnlockContext(this, valid, was_locked); |
| 447 | } |
| 448 | |
| 449 | WalletModel::UnlockContext::UnlockContext(WalletModel *_wallet, bool _valid, bool _relock): |
| 450 | wallet(_wallet), |
no test coverage detected