Skip to content

qt: remove unused 'Decrypt' wallet#42

Closed
sehyunc wants to merge 3 commits into
bitcoin-core:masterfrom
sehyunc:qt-remove-decrypt-case
Closed

qt: remove unused 'Decrypt' wallet#42
sehyunc wants to merge 3 commits into
bitcoin-core:masterfrom
sehyunc:qt-remove-decrypt-case

Conversation

@sehyunc

@sehyunc sehyunc commented Jul 31, 2020

Copy link
Copy Markdown
Contributor

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

hebasto commented Aug 1, 2020

Copy link
Copy Markdown
Member

Concept ACK.

@Saibato

Saibato commented Aug 1, 2020

Copy link
Copy Markdown
Contributor

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();
 }

@hebasto hebasto left a comment

Copy link
Copy Markdown
Member

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

hebasto commented Aug 1, 2020

Copy link
Copy Markdown
Member

@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

Saibato commented Aug 1, 2020

Copy link
Copy Markdown
Contributor

@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

hebasto commented Aug 2, 2020

Copy link
Copy Markdown
Member

@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

Saibato commented Aug 2, 2020

Copy link
Copy Markdown
Contributor

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

hebasto commented Aug 2, 2020

Copy link
Copy Markdown
Member

@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

Saibato commented Aug 3, 2020

Copy link
Copy Markdown
Contributor

@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

hebasto commented Aug 3, 2020

Copy link
Copy Markdown
Member

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

@achow101

achow101 commented Aug 3, 2020

Copy link
Copy Markdown
Member

Concept ACK

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

@maflcko

maflcko commented Aug 3, 2020

Copy link
Copy Markdown
Contributor

Please squash your commits according to https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commits

@hebasto

hebasto commented Sep 9, 2020

Copy link
Copy Markdown
Member

@sehyunc Are you going to address the latest comment?

@sehyunc

sehyunc commented Sep 11, 2020

Copy link
Copy Markdown
Contributor Author

@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

hebasto commented Oct 23, 2020

Copy link
Copy Markdown
Member

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

jarolrod commented Mar 4, 2021

Copy link
Copy Markdown
Contributor

@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