Skip to content

Conversation

psancheti110
Copy link
Contributor

@psancheti110 psancheti110 commented Jul 29, 2021

This PR adds SubFeeFromAmount option which lets the user select their preferred setting of whether fee for a transaction is to be subtracted from the amount or not for future transactions. The setting chosen by the user is remembered even when the GUI mode is turned off.

Functionality and Usage:

  • Go to Settings > Options > Wallet on Windows/Linux or bitcoin-qt > Preferences > Wallet on macOS.
  • The checkbox Subtract Fee From Amount corresponds to the added option SubFeeFromAmount.
  • The preferred setting intended to be the default for all future send transactions should be selected by the user.
  • Click on OK.
  • Go to the Send tab in the wallet.
  • You shall notice, any new Send transaction created will have the preferred setting as chosen by the user.
    (Try clicking on Add recipient or even restarting the Node in GUI)

Attaching ScreenRecordings to explain the added feature.

Master.mov: Master Branch

Master.mov

PR.mov: PullRequest

PR.mov

Close #386

@psancheti110 psancheti110 force-pushed the i386_0729 branch 2 times, most recently from 1d52b5d to 4dc9181 Compare July 31, 2021 20:11
@psancheti110 psancheti110 reopened this Aug 1, 2021
@psancheti110 psancheti110 changed the title [WIP] Add SubFeeFromAmount to options Add SubFeeFromAmount to options Aug 1, 2021
@psancheti110 psancheti110 marked this pull request as ready for review August 1, 2021 08:03
Copy link
Contributor

@shaavan shaavan left a comment

Choose a reason for hiding this comment

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

tACK 4dc9181
Tested on Ubuntu 20.04

This PR is adding a feature in the wallet settings so that the GUI will remember the default behavior of whether to subtract the fee from the transaction or not. As said by op this setting will be remembered even when the GUI is closed and reopened. This is done by setting a bool value based on if the checkbox is selected in settings or not, and then using that bool value to determine the default state of the SubFeeFromAmount option.
The PR is doing what it describes in the description. It is also not modifying any part of the code, which it should be modifying.
Adding some screenshots to show the proper working of the PR. The PR was compiled and ran on the signet chain.

  1. The subtract fee from amount option in settings (highlighted in green)
    Screenshot from 2021-08-02 19-54-29

  2. Selection of “subtract fee from amount” option by default:
    Screenshot from 2021-08-02 19-54-41

In my opinion, this PR is an improvement over the current master. For those who often use the “Subtract fee from amount” option, this feature can be quite handy.

Copy link
Member

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

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

Concept ACK, please add translator comments

@psancheti110
Copy link
Contributor Author

PR Updated from 4dc9181 -> 17d7b21
Addressed changes suggested by @jarolrod (PR#390 Comment)

Copy link
Member

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

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

Concept ACK

Existing recipients should respond to the 'SubFeeFromAmountChanged' signal.

There are scenarios where you have multiple recipients filled out. After you've filled them out, you now want all of them to 'Subtract fee from amount'. If we allow the existing recipients to respond to the 'SubFeeFromAmountChanged' signal, then you don't have to manually check every box. You can go into settings, set the option, come back and all of your recipients will not have the 'Subtract Fee from amount' box checked.

Similarly, if you already had the option set and created a bunch of recipients; you could unselect the option in settings and then all the boxes become unchecked.

@jarolrod jarolrod added UX All about "how to get things done" Wallet labels Aug 5, 2021
@hebasto
Copy link
Member

hebasto commented Aug 5, 2021

@jarolrod

Existing recipients should respond to the 'SubFeeFromAmountChanged' signal.

I don't agree.

The Options Dialog sets the default value of the "Subtract Fee..." setting. That means it is used only once per every recipient -- just initialize its own checkbox. In other words, it is not supposed to be a batch switcher.

There are scenarios where you have multiple recipients filled out. After you've filled them out, you now want all of them to 'Subtract fee from amount'. If we allow the existing recipients to respond to the 'SubFeeFromAmountChanged' signal, then you don't have to manually check every box. You can go into settings, set the option, come back and all of your recipients will not have the 'Subtract Fee from amount' box checked.

I'm not sure if this scenario would be ever convenient for users.

@psancheti110
Copy link
Contributor Author

PR Updated from 17d7b21 -> 50216bc . Click here to check diff.

Addressed changes suggested by @hebasto about coding style using clang-format-diff.py

@jarolrod
Copy link
Member

jarolrod commented Aug 6, 2021

Approach ACK

I rescind my comments here about the behavior of this option. The appropriate place for a batch switch would be in the Send tab itself. Please update the translator comments 🥃

@hebasto
Copy link
Member

hebasto commented Aug 7, 2021

Concept ACK.

Why a new "subFeeFromAmount" checkbox is placed within the "Expert" group? Shouldn't it be an independent option?

@psancheti110
Copy link
Contributor Author

@hebasto

Why a new "subFeeFromAmount" checkbox is placed within the "Expert" group? Shouldn't it be an independent option?

Agreed, It doesn't belong to an "expert" group. That's quite some observation there.

Will make the required changes and add.

@psancheti110
Copy link
Contributor Author

PR Updated from 50216bc -> fb194c3. Click here to check diff.

Addressed changes suggested by @hebasto for moving SubFeeFromAmount option outside "Expert" group and translator comments as suggested by @jarolrod.

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.

Approach ACK fb194c3, going to test and review more closely.

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.

Tested fb194c3 on Linux Mint 20.2 (Qt 5.12.8).

It works flawlessly, and it looks great:

Screenshot from 2021-08-08 22-54-14

@psancheti110
Copy link
Contributor Author

PR Updated from fb194c3 -> 54ce509. Click here to check diff.

Addressed changes suggested by @hebasto. Moved the definitions of SubFeeFromAmount under #ifdef ENABLE_WALLET because this functionality cannot work without a wallet being loaded.

Copy link
Member

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

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

Almost there, one last thing: #390 (comment)

@psancheti110
Copy link
Contributor Author

PR Updated from 54ce509 -> ec25093. Click here to check diff.

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.

ACK 7bf1a2b, tested on Linux Mint 20.2 (Qt 5.12.8).

Also I agree with the "qt, refactor: Fix indentation" commit (7bf1a2b) because every time optionsdialog.ui being opened in the Qt Designer, the latter tries to fix indentation, and produces unexpected changes.

@jarolrod
Copy link
Member

tACK 7bf1a2b

tested on macOS 12 and Ubuntu 20.04. The setting works nicely and is a definite UX improvement. Nice job 🥃

Copy link
Contributor

@shaavan shaavan left a comment

Choose a reason for hiding this comment

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

tACK 7bf1a2b
Tested on Ubuntu 20.04

Changes that OP made since my previous review:

  1. Formatting is fixed according to clang-format.
  2. Moved case SubFeeAmount under #ifdef ENABLE_WALLET to prevent this feature from working when wallet functionality is disabled.
  3. The AddSubFeeAmount options have been moved out of the Expert menu.
  4. Indentations in optionsdialog.ui have been fixed not to create unnecessary indentation changes when the file is opened in QTDesigner.

Screenshot:
Screenshot from 2021-08-10 20-13-32

Just want to add one small thing; you should modify the video describing the PR, as it is still showing the option under the Expert menu :)

@hebasto hebasto requested review from Sjors and meshcollider August 10, 2021 17:18
@psancheti110
Copy link
Contributor Author

PR Updated from 7bf1a2b -> 62b125f. Click here to check diff.

Addressed changes suggested by @meshcollider.

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.

re-ACK 62b125f, only removed the unused SubFeeFromAmountChanged signal since my previous review.

@Talkless
Copy link

tACK 62b125f, tested on Debian Sid with 5.15.2 and it works as described.

Copy link
Contributor

@meshcollider meshcollider left a comment

Choose a reason for hiding this comment

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

utACK 62b125f

@hebasto hebasto merged commit 9948f11 into bitcoin-core:master Aug 11, 2021
@psancheti110
Copy link
Contributor Author

A big thanks to all the contributors who took out time to test and review my PR.
Appreciate each and every comment made here by fellow mates
🙌🏻

sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 15, 2021
@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
UX All about "how to get things done" Wallet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please automatically remember when the user checks 'Subtract fee from amount'
6 participants