Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qt: remove unused 'Decrypt' wallet #42

Closed
wants to merge 3 commits into from

Conversation

sehyunc
Copy link
Contributor

@sehyunc sehyunc commented Jul 31, 2020

Fix #1
remove 'Decrypt' case from enum in AskPassPhraseDialog
remove 'Decrypt' case from switch statements
show only Encrypt option in dialog
would appreciate feedback, specifically on src/qt/walletview.cpp:265

@hebasto
Copy link
Member

hebasto commented Aug 1, 2020

Concept ACK.

@Saibato
Copy link
Contributor

Saibato commented Aug 1, 2020

Concept tACK f9d41da

minor nit how about this?

index 26aa38320..2ba74082f 100644
--- a/src/qt/walletview.cpp
+++ b/src/qt/walletview.cpp
@@ -262,9 +262,11 @@ void WalletView::encryptWallet(bool status)
 {
     if(!walletModel)
         return;
-    AskPassphraseDialog dlg(status ? AskPassphraseDialog::Encrypt : AskPassphraseDialog::Encrypt, this);
-    dlg.setModel(walletModel);
-    dlg.exec();
+    if (walletModel->getEncryptionStatus() == WalletModel::Unencrypted) {
+        AskPassphraseDialog dlg(AskPassphraseDialog::Encrypt, this);
+        dlg.setModel(walletModel);
+        dlg.exec();
+    }
 
     updateEncryptionStatus();
 }

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a general rule each commit must compile and pass tests. Therefore, please squash all commits into a single one.

Mind refactoring enum Mode into enum class Mode? (this suggestion could be leaved for an followup though)

Since the encryptWalletAction is enabled only after encryptWalletAction->setChecked(false) (see: BitcoinGUI::setEncryptionStatus()), may I suggest to explicitly ignore the bool parameter (or, better, assert(!status)) in WalletFrame::encryptWallet(), and make WalletView::encryptWallet() parameterless?

@hebasto
Copy link
Member

hebasto commented Aug 1, 2020

@Saibato

Concept tACK f9d41da

minor nit how about this?

index 26aa38320..2ba74082f 100644
--- a/src/qt/walletview.cpp
+++ b/src/qt/walletview.cpp
@@ -262,9 +262,11 @@ void WalletView::encryptWallet(bool status)
 {
     if(!walletModel)
         return;
-    AskPassphraseDialog dlg(status ? AskPassphraseDialog::Encrypt : AskPassphraseDialog::Encrypt, this);
-    dlg.setModel(walletModel);
-    dlg.exec();
+    if (walletModel->getEncryptionStatus() == WalletModel::Unencrypted) {
+        AskPassphraseDialog dlg(AskPassphraseDialog::Encrypt, this);
+        dlg.setModel(walletModel);
+        dlg.exec();
+    }
 
     updateEncryptionStatus();
 }

Condition walletModel->getEncryptionStatus() == WalletModel::Unencrypted is always true here, right? Why do we need to add it?

@Saibato
Copy link
Contributor

Saibato commented Aug 1, 2020

@hebasto tyi , not what I observed, when testing, maybe a minor bug?

always true here, right? Why do we need to add it?

The flag is an int and give us the info we need here.

The bool does sometimes not correctly reflect all three states.
And then you could encrypt and encrypted again, what makes not that much sense.
Could be a minor bug that sets the status wrong before call?

Maybe @sehyunc like to find out as an exercise?

Did not dig deeper. tyi

@hebasto
Copy link
Member

hebasto commented Aug 2, 2020

@Saibato

@hebasto tyi , not what I observed, when testing, maybe a minor bug?

Mind providing steps to reproduce it?

The bool does sometimes not correctly reflect all three states.

The bool is just a value of encryptWalletAction->checked(), see:

@Saibato
Copy link
Contributor

Saibato commented Aug 2, 2020

Mind providing steps to reproduce it?

@hebasto sure if iirc, compile i.e. with the PR or just

  `AskPassphraseDialog dlg(AskPassphraseDialog::Encrypt, this) `

then create multiple wallets load all encrypt all, close all and then load them randomly and then try click encrypt. You probably will find by that even the next bug not mentioned yet, hoops you asked, I like that ping pong push things forward.
And as they say, its a marathon not a sprint,
One runs the other backup and then baton or name/avatar change before the bugs hit in.

@hebasto
Copy link
Member

hebasto commented Aug 2, 2020

@Saibato

Testing fb5b460 on Linux Mint 20 (Qt 5.12.8)...

then create multiple wallets load all encrypt all

... done...

close all

... done...

and then load them randomly

... done...

and then try click encrypt.

I cannot click "Encrypt Wallet" menu item because it is disabled. As expected :)

Screenshot from 2020-08-03 02-16-01

@Saibato
Copy link
Contributor

Saibato commented Aug 3, 2020

@hebasto
And i could, so could it be since that now has happened more than often that your configuration and testing setup, could not confirm things,

So you as somewhat main gui dev should maybe switch to common used platforms ubuntu/lubuntu/debian/mac with there default qt dev libs or could be we have here a hardware dependent racing condition?

Or maybe I have the most exotic combination and the AI that simulates me is not efficient or fast enough to guess how it must simulate the desktop my virtual eye's will see?

checkwallet

@hebasto
Copy link
Member

hebasto commented Aug 3, 2020

@Saibato
The bug you described fixed in #43. Mind testing it?

@achow101
Copy link
Member

achow101 commented Aug 3, 2020

Concept ACK

As noted by others, the commit order should be reversed or all the commits squashed so that each commit individually compiles.

@maflcko
Copy link
Contributor

maflcko commented Aug 3, 2020

@hebasto
Copy link
Member

hebasto commented Sep 9, 2020

@sehyunc Are you going to address the latest comment?

@sehyunc
Copy link
Contributor Author

sehyunc commented Sep 11, 2020

@sehyunc Are you going to address the latest comment?

Yes, apologies, have been caught up in school work. Will try my best to push a new commit.

@hebasto
Copy link
Member

hebasto commented Oct 23, 2020

Fellow reviewers! Please review #109.

maflcko pushed a commit that referenced this pull request Nov 18, 2020
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 #42 with an additional commit.

  Fix #1.

ACKs for top commit:
  MarcoFalke:
    ACK 4146a31
  promag:
    Code review ACK 4146a31.

Tree-SHA512: 6070d8995525af826ad972cf1b8988ff98af0528eef285a07ec7ba0e2e92a7a6173a19dc371de94d4b437fa10f7921166e45a081de6ed2f4306e6502aafc94ee
@maflcko maflcko closed this Nov 18, 2020
laanwj pushed a commit that referenced this pull request Dec 9, 2020
b5ef9be675 Merge #1: Merge changes from upstream
9e7f512430 Merge remote-tracking branch 'origin/master' into bitcoin-fork
1f85030246 Add support for ARM64 darwin (#43)
3bb959c982 Remove unnecessary reinterpret_cast (#42)
2e97ab26b1 Fix (unused) ReadUint64LE for BE machines (#41)
47b40d2209 Bump dependencies. (#40)
ba74185625 Move CI to Visual Studio 2019.
efa301a7e5 Allow different C/C++ standards when this is used as a subproject.
cc6d71465e CMake: Use configure_package_config_file()

git-subtree-dir: src/crc32c
git-subtree-split: b5ef9be6755a2e61e2988bb238f13d1c0ee1fa0a
@jarolrod
Copy link
Member

jarolrod commented Mar 4, 2021

@MarcoFalke @hebasto can the waiting for author and up for grab labels be removed from here as to not confuse anyone who may start on this by accident.

@bitcoin-core bitcoin-core locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gui: Remove unused Decrypt wallet
6 participants