Better error message for user when corrupt wallet unlock fails
This commit is contained in:
parent
be992701b0
commit
b4f6e58ca5
2 changed files with 10 additions and 9 deletions
|
@ -152,14 +152,15 @@ void AskPassphraseDialog::accept()
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case Unlock:
|
case Unlock:
|
||||||
if(!model->setWalletLocked(false, oldpass))
|
try {
|
||||||
{
|
if (!model->setWalletLocked(false, oldpass)) {
|
||||||
QMessageBox::critical(this, tr("Wallet unlock failed"),
|
QMessageBox::critical(this, tr("Wallet unlock failed"),
|
||||||
tr("The passphrase entered for the wallet decryption was incorrect."));
|
tr("The passphrase entered for the wallet decryption was incorrect."));
|
||||||
}
|
} else {
|
||||||
else
|
QDialog::accept(); // Success
|
||||||
{
|
}
|
||||||
QDialog::accept(); // Success
|
} catch (const std::runtime_error& e) {
|
||||||
|
QMessageBox::critical(this, tr("Wallet unlock failed"), e.what());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Decrypt:
|
case Decrypt:
|
||||||
|
|
|
@ -202,7 +202,7 @@ bool CCryptoKeyStore::Unlock(const CKeyingMaterial& vMasterKeyIn)
|
||||||
if (keyPass && keyFail)
|
if (keyPass && keyFail)
|
||||||
{
|
{
|
||||||
LogPrintf("The wallet is probably corrupted: Some keys decrypt but not all.\n");
|
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)
|
if (keyFail || !keyPass)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue