-
Notifications
You must be signed in to change notification settings - Fork 14
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
Conversation
There was a problem hiding this 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.
tinywallet/tinywallet/screens.py
Outdated
self.relayFeeField = QtWidgets.QLineEdit(str(app.settings[DB.relayFee])) | ||
lbl = Q.makeLabel(" atoms / kb ", 14) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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. 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. |
4780ecd
to
371d8cd
Compare
There was a problem hiding this 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.
tinywallet/tinywallet/screens.py
Outdated
self.account.relayFee = relayFee | ||
self.acctMgr.saveAccount(self.account.idx) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
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.
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