Skip to content

Commit 0cc5f0f

Browse files
MarcoFalkePastaPastaPasta
MarcoFalke
authored andcommitted
Merge bitcoin-core/gui#109: wallet: Remove unused AskPassphraseDialog::Decrypt
4146a31 qt, wallet: Drop unused parameter in WalletModel::setWalletEncrypted (Hennadii Stepanov) f886a20 qt, wallet: Drop unused parameter in Wallet{Frame|View}::encryptWallet (Hennadii Stepanov) 6e95011 qt, wallet: Remove unused AskPassphraseDialog::Decrypt (Hennadii Stepanov) Pull request description: Grabbed from dashpay#42 with an additional commit. Fix #1. ACKs for top commit: MarcoFalke: ACK 4146a31 promag: Code review ACK 4146a31. Tree-SHA512: 6070d8995525af826ad972cf1b8988ff98af0528eef285a07ec7ba0e2e92a7a6173a19dc371de94d4b437fa10f7921166e45a081de6ed2f4306e6502aafc94ee
1 parent 55d78e8 commit 0cc5f0f

File tree

4 files changed

+5
-34
lines changed

4 files changed

+5
-34
lines changed

src/qt/askpassphrasedialog.cpp

+2-27
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,6 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent, SecureStri
7373
ui->passEdit3->hide();
7474
setWindowTitle(tr("Unlock wallet"));
7575
break;
76-
case Decrypt: // Ask passphrase
77-
ui->warningLabel->setText(tr("This operation needs your wallet passphrase to decrypt the wallet."));
78-
ui->passLabel2->hide();
79-
ui->passEdit2->hide();
80-
ui->passLabel3->hide();
81-
ui->passEdit3->hide();
82-
setWindowTitle(tr("Decrypt wallet"));
83-
break;
8476
case ChangePass: // Ask old passphrase + new passphrase x2
8577
setWindowTitle(tr("Change passphrase"));
8678
ui->warningLabel->setText(tr("Enter the old passphrase and new passphrase for the wallet."));
@@ -148,8 +140,7 @@ void AskPassphraseDialog::accept()
148140
"</b></qt>");
149141
} else {
150142
assert(model != nullptr);
151-
if(model->setWalletEncrypted(true, newpass1))
152-
{
143+
if (model->setWalletEncrypted(newpass1)) {
153144
if (model->wallet().hdEnabled()) {
154145
QMessageBox::warning(this, tr("Wallet encrypted"),
155146
"<qt>" +
@@ -171,9 +162,7 @@ void AskPassphraseDialog::accept()
171162
"will become useless as soon as you start using the new, encrypted wallet.") +
172163
"</b></qt>");
173164
}
174-
}
175-
else
176-
{
165+
} else {
177166
QMessageBox::critical(this, tr("Wallet encryption failed"),
178167
tr("Wallet encryption failed due to an internal error. Your wallet was not encrypted."));
179168
}
@@ -207,17 +196,6 @@ void AskPassphraseDialog::accept()
207196
QMessageBox::critical(this, tr("Wallet unlock failed"), e.what());
208197
}
209198
break;
210-
case Decrypt:
211-
if(!model->setWalletEncrypted(false, oldpass))
212-
{
213-
QMessageBox::critical(this, tr("Wallet decryption failed"),
214-
tr("The passphrase entered for the wallet decryption was incorrect."));
215-
}
216-
else
217-
{
218-
QDialog::accept(); // Success
219-
}
220-
break;
221199
case ChangePass:
222200
if(newpass1 == newpass2)
223201
{
@@ -253,9 +231,6 @@ void AskPassphraseDialog::textChanged()
253231
break;
254232
case UnlockMixing: // Old passphrase x1
255233
case Unlock: // Old passphrase x1
256-
case Decrypt:
257-
acceptable = !ui->passEdit1->text().isEmpty();
258-
break;
259234
case ChangePass: // Old passphrase x1, new passphrase x2
260235
acceptable = !ui->passEdit1->text().isEmpty() && !ui->passEdit2->text().isEmpty() && !ui->passEdit3->text().isEmpty();
261236
break;

src/qt/askpassphrasedialog.h

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class AskPassphraseDialog : public QDialog
2727
UnlockMixing, /**< Ask passphrase and unlock only for mixing */
2828
Unlock, /**< Ask passphrase and unlock */
2929
ChangePass, /**< Ask old passphrase + new passphrase twice */
30-
Decrypt /**< Ask passphrase and decrypt wallet */
3130
};
3231

3332
explicit AskPassphraseDialog(Mode mode, QWidget *parent, SecureString* passphrase_out = nullptr);

src/qt/walletmodel.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,9 @@ WalletModel::EncryptionStatus WalletModel::getEncryptionStatus() const
368368
}
369369
}
370370

371-
bool WalletModel::setWalletEncrypted(bool encrypted, const SecureString &passphrase)
371+
bool WalletModel::setWalletEncrypted(const SecureString& passphrase)
372372
{
373-
if (encrypted) {
374-
return m_wallet->encryptWallet(passphrase);
375-
}
376-
return false;
373+
return m_wallet->encryptWallet(passphrase);
377374
}
378375

379376
bool WalletModel::setWalletLocked(bool locked, const SecureString &passPhrase, bool fMixing)

src/qt/walletmodel.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class WalletModel : public QObject
106106
SendCoinsReturn sendCoins(WalletModelTransaction &transaction, bool fIsCoinJoin);
107107

108108
// Wallet encryption
109-
bool setWalletEncrypted(bool encrypted, const SecureString &passphrase);
109+
bool setWalletEncrypted(const SecureString& passphrase);
110110
// Passphrase only needed when unlocking
111111
bool setWalletLocked(bool locked, const SecureString &passPhrase=SecureString(), bool fMixing=false);
112112
bool changePassphrase(const SecureString &oldPass, const SecureString &newPass);

0 commit comments

Comments
 (0)