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

[Wallet] If nautomintdenom is set, prioritize its use #908

Merged
merged 1 commit into from
Apr 24, 2021

Conversation

Rock-N-Troll
Copy link

@Rock-N-Troll Rock-N-Troll commented Mar 27, 2021

nPreferredDenom == DEFAULT_AUTOMINT_DENOM is actually false because:
nPreferredDenom is 10
DEFAULT_AUTOMINT_DENOM is 1000

This code change just wraps the 2 nPreferredDenom inits based on if nautomindenom is set or not in the config.

The real existing issue is in veil.cpp which occurs after init.cpp and overwrites the logic in veil.cpp for nautomintdenom anyway when it pulls from QT getSettings()

Easiest way to test is to compare this code vs. existing
use a fresh wallet or re-build/remake from code and config file nautomintdenom value is not used on initial startup

Release Note

[GUI] Users that have set their desired zerocoin automint denomination via the GUI and in the veil.conf file will now find the configuration file setting is used over the GUI setting. If the veil configuration file has an automint denom setting, the GUI controls are now disabled and the user informed.

@Rock-N-Troll Rock-N-Troll changed the title if nautomintdenom is set, prioritize its use [Wallet] If nautomintdenom is set, prioritize its use Mar 27, 2021
@codeofalltrades codeofalltrades added Tag: Automint Tag: Waiting For Code Review Waiting for code review from a core developer labels Mar 27, 2021
@Rock-N-Troll Rock-N-Troll changed the title [Wallet] If nautomintdenom is set, prioritize its use [WIP][Wallet] If nautomintdenom is set, prioritize its use Mar 27, 2021
@Rock-N-Troll
Copy link
Author

image

@Rock-N-Troll Rock-N-Troll changed the title [WIP][Wallet] If nautomintdenom is set, prioritize its use [Wallet] If nautomintdenom is set, prioritize its use Mar 28, 2021
@CaveSpectre11
Copy link
Collaborator

CaveSpectre11 commented Mar 28, 2021

Generally we like to see multiple commits rebased down to one single commit (git rebase -i HEAD~6 and then change the ones that you want to combine to 'fixup'), but in this case I would be okay with 2 commits; one for the prioritization, and one for the disabling of the UI.

image

After you run a git rebase -i you need to push -f rather than just a straight push since the hashes will change.

@CaveSpectre11 CaveSpectre11 added the Tag: Needs Release Notes Any PR or Issue that needs notable mention in release notes label Mar 28, 2021
Copy link
Collaborator

@CaveSpectre11 CaveSpectre11 left a comment

Choose a reason for hiding this comment

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

Still need to do some testing; but overall looks good with a few minor things.

src/qt/veil.cpp Outdated
Comment on lines 652 to 654
// Preferences check
// If the UI settings have a different value than the server args then use the UI settings.
// Automint denom
// If nautomintdenom is set, use it
// Else use saved UI settings
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change is a behavior change (changing the preference from the UI setting to the veil.conf setting) so definitely needs a statement in the release notes; as those that have both will see a change in behavior.

src/qt/veil.cpp Outdated
// If the UI settings have a different value than the server args then use the UI settings.
// Automint denom
// If nautomintdenom is set, use it
// Else use saved UI settings
QSettings* settings = getSettings();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since settings isn't used anywhere else, this should be moved into the if not IsArgSet context, so it doesn't waste the cycles if it's not going to be used.

Copy link
Author

Choose a reason for hiding this comment

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

Yes I was thinking the same thing but left it as is for simplicity's sake. Will update

@@ -177,35 +187,35 @@ void SettingsMinting::mintzerocoins()
}

void SettingsMinting::onCheck10Clicked(bool res) {
if(res && nPreferredDenom != 10){
if(res && !gArgs.IsArgSet("-nautomintdenom") && nPreferredDenom != 10){
Copy link
Collaborator

Choose a reason for hiding this comment

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

This (and others) shouldn't be necessary since the radio buttons would be disabled if nautomintdenom is set. No sense wasting the cycles for code that wouldn't be reached if it argument was set.

Copy link
Author

Choose a reason for hiding this comment

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

Agreed. I'll remove

Copy link
Collaborator

@CaveSpectre11 CaveSpectre11 left a comment

Choose a reason for hiding this comment

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

utACK 3ad26d3

@codeofalltrades
Copy link
Collaborator

It seems like this is partially working. The disabled setting screen when nautomintdenom is set works.
If I remove nautomintdenom, restart the wallet, set the size, then restart the setting is not retained.

@Rock-N-Troll
Copy link
Author

It seems like this is partially working. The disabled setting screen when nautomintdenom is set works.
If I remove nautomintdenom, restart the wallet, set the size, then restart the setting is not retained.

I think that is an existing issue, but let me see what I can do

if nautomintdenom is set, do not allow UI update of nPreferredDenom
settings minting screen GUI checkbox save fix
@Rock-N-Troll
Copy link
Author

Rock-N-Troll commented Apr 20, 2021

The latest commit will also properly apply the saved checkbox settings whereas previously and existing code wasn't working. I also squashed to 1 commit while I was on the branch.

Copy link
Collaborator

@codeofalltrades codeofalltrades left a comment

Choose a reason for hiding this comment

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

ACK 313772e

@codeofalltrades codeofalltrades added Tag: Waiting For QA A pull review is waiting for QA to test the pull request and removed Tag: Waiting For Code Review Waiting for code review from a core developer labels Apr 20, 2021
@codeofalltrades codeofalltrades merged commit bd492de into Veil-Project:master Apr 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tag: Automint Tag: Needs Release Notes Any PR or Issue that needs notable mention in release notes Tag: Waiting For QA A pull review is waiting for QA to test the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants