diff --git a/src/qt/askpassphrasedialog.cpp b/src/qt/askpassphrasedialog.cpp --- a/src/qt/askpassphrasedialog.cpp +++ b/src/qt/askpassphrasedialog.cpp @@ -168,12 +168,19 @@ } } break; case Unlock: - if (!model->setWalletLocked(false, oldpass)) { + try { + if (!model->setWalletLocked(false, oldpass)) { + QMessageBox::critical( + this, tr("Wallet unlock failed"), + tr("The passphrase entered for the wallet decryption " + "was incorrect.")); + } else { + // Success + QDialog::accept(); + } + } catch (const std::runtime_error &e) { QMessageBox::critical(this, tr("Wallet unlock failed"), - tr("The passphrase entered for the " - "wallet decryption was incorrect.")); - } else { - QDialog::accept(); // Success + e.what()); } break; case Decrypt: diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -175,7 +175,9 @@ if (keyPass && keyFail) { LogPrintf("The wallet is probably corrupted: Some keys decrypt but " "not all.\n"); - assert(false); + throw std::runtime_error( + "Error unlocking wallet: some keys decrypt but not all. Your " + "wallet file may be corrupt."); } if (keyFail || (!keyPass && !accept_no_keys)) { return false;