Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Redefine Dust and add a discard_rate #10817
Conversation
fanquake
added the
Wallet
label
Jul 14, 2017
|
Clean rebase now that #10706 was merged |
morcos
changed the title from
Add a discard_rate to avoid small change to Redefine Dust and add a discard_rate
Jul 17, 2017
|
This PR has been changed to redefine dust and move the discard rate slightly lower. See new PR description. |
|
After discussion with @gmaxwell, just wanted to point out that the edge case rounding issues would only be with non-standard dust rates. Since the default dust rate was 1000 sat/kB and the division in question was by 1000, then there are no rounding issues regardless of the output in question. |
|
utACK 28da790 |
| + unsigned int highest_target = estimator.HighestTargetTracked(FeeEstimateHorizon::LONG_HALFLIFE); | ||
| + CFeeRate discard_rate = estimator.estimateSmartFee(highest_target, nullptr /* FeeCalculation */, false /* conservative */); | ||
| + discard_rate = std::min(discard_rate, CWallet::m_discard_rate); | ||
| + discard_rate = std::max(discard_rate, ::dustRelayFee); |
ryanofsky
Jul 17, 2017
Contributor
In commit "Add a discard_rate"
Maybe it should be an init error to specify -dustrelayfee greater than -discardrate, because the -discardrate value is ignored in this case.
| + return InitError(strprintf(_("Invalid amount for -discardfee=<amount>: '%s'"), GetArg("-discardfee", ""))); | ||
| + if (nFeePerK > HIGH_TX_FEE_PER_KB) | ||
| + InitWarning(AmountHighWarn("-discardfee") + " " + | ||
| + _("This is the transaction fee you may discard if change is smaller than dust at this level")); |
ryanofsky
Jul 17, 2017
Contributor
In commit "Add a discard_rate"
Pedantic, but maybe s/transaction fee/maximum transaction fee/
laanwj
added this to the
0.15.0
milestone
Jul 17, 2017
TheBlueMatt
reviewed
Jul 17, 2017
This is awesome, though it would be nice to document the limits for discardfee (must be at least dust relay fee, will not go higher than estimate fee).
| +static CFeeRate GetDiscardRate(const CBlockPolicyEstimator& estimator) | ||
| +{ | ||
| + unsigned int highest_target = estimator.HighestTargetTracked(FeeEstimateHorizon::LONG_HALFLIFE); | ||
| + CFeeRate discard_rate = estimator.estimateSmartFee(highest_target, nullptr /* FeeCalculation */, false /* conservative */); |
instagibbs
Jul 17, 2017
Member
i.e., failure to get a real estimate means we'll go to dustRelayFee instead of static discard rate
morcos
Jul 17, 2017
Contributor
Yes I suppose that would be a slight improvement. Stupid 0 as error value
|
Addressed comments |
|
utACK f4d00e6 |
|
utACK f4d00e6 |
ryanofsky
reviewed
Jul 18, 2017
utACK f4d00e6. Has new safeguard against failing fee estimate & more comments and documentation.
|
utACK with new safeguard logic |
laanwj
merged commit f4d00e6
into
bitcoin:master
Jul 19, 2017
1 check passed
laanwj
added a commit
that referenced
this pull request
Jul 19, 2017
|
|
laanwj |
9022aa3
|
morcos commentedJul 13, 2017
•
edited
The definition of dust is redefined to remove the factor of 3.
Dust is redefined to be the value of an output such that it would
cost that value in fees to (create and) spend the output at the dust
relay rate. The previous definition was that it would cost 1/3 of the
value. The default dust relay rate is correspondingly increased to
3000 sat/kB so the actual default dust output value of 546 satoshis
for a non-segwit output remains unchanged. This commit is a refactor
only unless a dustrelayfee is passed on the commandline in which case
that number now needs to be increased by a factor of 3 to get the same
behavior. -dustrelayfee is a hidden command line option.
Note: It's not exactly a refactor due to edge case changes in rounding
as evidenced by the required change to the unit test.
A discard_rate is added which defaults to 10,000 sat/kB
Any change output which would be dust at the discard_rate you are
willing to discard completely and add to fee (as well as continuing to
pay the fee that would have been needed for creating the change)
This would be a nice addition for 0.15 and I think will remain useful for 0.16 with the new coin selection algorithms in discussion, but its not crucial.
It does add translation strings, but we could (should?) avoid that by hiding the option