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

app: Add relay fee setting #152

Merged
merged 3 commits into from
Apr 22, 2020
Merged

app: Add relay fee setting #152

merged 3 commits into from
Apr 22, 2020

Conversation

JoeGruffins
Copy link
Member

Add a relay fee to settings and allow changing. The fee is not yet used.

In an attempt to keep prs small, this only adds the setting, it does not use it.

Related to #28

@JoeGruffins JoeGruffins marked this pull request as ready for review April 2, 2020 11:00
Copy link
Member

@buck54321 buck54321 left a comment

Choose a reason for hiding this comment

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

I think the fee rate settings should be account-specific. The input field would be on the AccountSettingsScreen and the value would be saved to the Account.masterDB.

On the other hand, if you did want an asset-wide setting, I would create a settings table for AccountManager and save the value there. Might consider moving the dcrdata url there too.

Comment on lines 1108 to 1109
self.relayFeeField = QtWidgets.QLineEdit(str(app.settings[DB.relayFee]))
lbl = Q.makeLabel(" atoms / kb ", 14)
Copy link
Member

Choose a reason for hiding this comment

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

Field is pretty wide for the few digits needed. Fiddle with the width of the field, self.relayFeeField.setFixedWidth, and the grid layout. You may have to use the optional columnSpan argument of QGridLayout.addWidget to get things to look right.

Copy link
Member Author

@JoeGruffins JoeGruffins Apr 7, 2020

Choose a reason for hiding this comment

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

I actually think just three choices would be better for a user. With the few wallet apps I have used it is so. You can choose from the normal fee or more/less. Is having a lower fee even a good idea I wonder? Anyway, I will get some data from the blockchain and share before continuing.

@JoeGruffins
Copy link
Member Author

JoeGruffins commented Apr 9, 2020

Here is a graph using https://github.com/JoeGruffins/pyscripts/blob/master/plotfees/main.py and looking at the last 10004 transactions on mainnet.

This graph uses 1e4 as the standard rate and multiples of that rate. i.e. 1e4 rates are shown as 1 on the x axis and 1e4 * 10 would be a 10. Rates near 400 are paying 400 times the default rate (actually a flat rate of 0.01dcr). y axis is number of instances.

fees

1047 or 10% of transactions used a fee higher than the default.

There are barely any low fee transactions. Only 9 in the set. But those that did pay a low fee paid 4000 a/kb fee.

The majority of high fee's came from 10 ~ 15 times the default. 198 cases or 19% of those that paid high fees at all. Of these the average was 114000 a/kb.

As such I think it makes sense for the low fee to be 4000 a/kb and high fee to be 114,000 a/kb.

@JoeGruffins JoeGruffins force-pushed the defaulfee branch 2 times, most recently from 4780ecd to 371d8cd Compare April 10, 2020 02:25
@JoeGruffins
Copy link
Member Author

Radio buttons:
radio

Copy link
Member

@buck54321 buck54321 left a comment

Choose a reason for hiding this comment

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

Looks pretty good. I think the radio buttons are perfect for tinywallet.

Throw a little space between the form rows. Can use QWidget.setContentsMargins or insert a spacer widget like here. Also should display the current value. I prefer the atoms/byte unit personally.

image

tinywallet/tinywallet/screens.py Outdated Show resolved Hide resolved
Comment on lines 729 to 730
self.account.relayFee = relayFee
self.acctMgr.saveAccount(self.account.idx)
Copy link
Member

Choose a reason for hiding this comment

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

Let's do an AccountManager method def setRelayFee(acctIdx, fee): instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure I did what you wanted here. Let me know.

tinywallet/tinywallet/screens.py Outdated Show resolved Hide resolved
tinywallet/tinywallet/screens.py Show resolved Hide resolved
Copy link
Member

@buck54321 buck54321 left a comment

Choose a reason for hiding this comment

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

Looks much better. A couple final touchups needed.

decred/decred/wallet/accounts.py Outdated Show resolved Hide resolved
tinywallet/tinywallet/screens.py Outdated Show resolved Hide resolved
Add a relay fee to settings and allow changing. The fee is not yet used.

Save the relay fee with the account. Allow changing of the relay fee in
Account settings as apposed to App settings. Change relay fee input
field to radio buttons with labels low, default, and high. Set
appropriate values for low (4000) and high (114000).
Use Roboto font. Display fee in atoms / byte. Add space above relay fee
section. Halve high fee.
@buck54321 buck54321 merged commit 87fea26 into decred:master Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants