Skip to content

Commit

Permalink
Remove unused status parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
barton2526 committed Aug 25, 2021
1 parent 71dccbe commit 11604f6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 27 deletions.
22 changes: 7 additions & 15 deletions src/qt/askpassphrasedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,9 @@ void AskPassphraseDialog::accept()
tr("Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR COINS</b>!") + "<br><br>" + tr("Are you sure you wish to encrypt your wallet?"),
QMessageBox::Yes|QMessageBox::Cancel,
QMessageBox::Cancel);
if(retval == QMessageBox::Yes)
{
if(newpass1 == newpass2)
{
if(model->setWalletEncrypted(true, newpass1))
{
if(retval == QMessageBox::Yes) {
if(newpass1 == newpass2) {
if(model->setWalletEncrypted(newpass1)) {
QMessageBox::warning(this, tr("Wallet encrypted"),
"<qt>" +
tr("Gridcoin will close now to finish the encryption process. "
Expand All @@ -123,24 +120,19 @@ void AskPassphraseDialog::accept()
"</b></qt>");
QApplication::quit();
}
else
{
else {
QMessageBox::critical(this, tr("Wallet encryption failed"),
tr("Wallet encryption failed due to an internal error. Your wallet was not encrypted."));
}
QDialog::accept(); // Success
}
else
{
} else {
QMessageBox::critical(this, tr("Wallet encryption failed"),
tr("The supplied passphrases do not match."));
}
}
else
{
} else {
QDialog::reject(); // Cancelled
}
} break;
} break;
case UnlockStaking:
case Unlock:
if(!model->setWalletLocked(false, oldpass))
Expand Down
2 changes: 1 addition & 1 deletion src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,7 @@ void BitcoinGUI::setEncryptionStatus(int status)
}
}

void BitcoinGUI::encryptWallet(bool status)
void BitcoinGUI::encryptWallet()
{
if(!walletModel)
return;
Expand Down
2 changes: 1 addition & 1 deletion src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ private slots:
*/
void incomingTransaction(const QModelIndex & parent, int start, int end);
/** Encrypt the wallet */
void encryptWallet(bool status);
void encryptWallet();
/** Backup the wallet */
void backupWallet();
/** Change encrypted wallet passphrase */
Expand Down
10 changes: 1 addition & 9 deletions src/qt/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,17 +323,9 @@ WalletModel::EncryptionStatus WalletModel::getEncryptionStatus() const
}
}

bool WalletModel::setWalletEncrypted(bool encrypted, const SecureString &passphrase)
bool WalletModel::setWalletEncrypted(const SecureString& passphrase)
{
if(encrypted)
{
// Encrypt
return wallet->EncryptWallet(passphrase);
}
else
{
return false;
}
}

bool WalletModel::setWalletLocked(bool locked, const SecureString &passPhrase)
Expand Down
2 changes: 1 addition & 1 deletion src/qt/walletmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class WalletModel : public QObject
SendCoinsReturn sendCoins(const QList<SendCoinsRecipient>& recipients, const CCoinControl* coinControl = nullptr);

// Wallet encryption
bool setWalletEncrypted(bool encrypted, const SecureString& passphrase);
bool setWalletEncrypted(const SecureString& passphrase);
// Passphrase only needed when unlocking
bool setWalletLocked(bool locked, const SecureString& passPhrase=SecureString());
bool changePassphrase(const SecureString& oldPass, const SecureString& newPass);
Expand Down

0 comments on commit 11604f6

Please sign in to comment.