-
Notifications
You must be signed in to change notification settings - Fork 306
multi: Implement smart fee estimation. #1434
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
Conversation
Sending for initial review and to discuss some last points that might require working before merging. As a preliminary, I'm sending attached the fee database collected over the last few days in mainnet, and the dump of the estimator state for this same database: feesdb-mainnet.tar.gz Results of the estimation:
A few notes for discussion:
|
46cf163
to
2922e7c
Compare
Nicely done @matheusd, numblocks parameter description for |
2922e7c
to
4264608
Compare
Current stats after running in mainnet for ~2 weeks.
|
15ef7ab
to
b0cc3e0
Compare
1ff111b
to
23cf919
Compare
5188286
to
863ab8a
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.
The EstimateSmartFee
command in dcrjson
needs to be updated to make the second parameter optional as well. Currently it is required.
fees/estimator.go
Outdated
bucketFees := make([]feeRate, 0) | ||
prevF := 0.0 | ||
for f := float64(cfg.MinBucketFee); f < max; f *= cfg.FeeRateStep { | ||
if (f > 1e5) && (prevF < 1e5) { |
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.
Seems like this should be using a value passed in from elsewhere (perhaps policy.DefaultMinRelayTxFee
), especially since wallet should be using 1e4 now. Otherwise this will certainly get out of date.
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.
Slight difficulty on this one. I've moved the constant out of the fees package to the server.go file, passing it as an ExtraBucketFee
to be inserted.
The main issue with using DefaultMinRelayTxFee
is that this is not supposed to be current fee, but rather the one that the majority of the wallets are using (ie, the previous DefaultMinRelayTxFee).
So, one alternative would be to explicitly add a mempool.PreviousDefaultMinRelayTxFee
and add comments detailing that it should be bumped once DefaultMinRelayTxFee
is also bumped.
Another one, to make this less "magical" would be to remove this constant altogether and add explicit tracking of all order-of-magnitude bucket fees in the range (1e3, 1e4, 1e5, etc).
6349219
to
e12ae0d
Compare
This adds the first version of the fees package, responsible for performing fee estimation of network transactions. The main goal of fee estimation is to allow the usage of dynamic fees by wallets, contingent on block contention and the desired confirmation range for a given transaction. This version was based on bitcoin core fee estimation.
This commit performs the necessary modifications to hook the fee estimation facility added by the previous commit into the node software. The block manager is modified to notify the estimator of all new blocks, such that their transactions can be accounted for, and the mempool is modified to relay transactions entering and leaving it, so that those transactions can be tracked. The results of the estimator can be queried by issuing estimatesmartfee rpc commands to the node.
efc2236
to
300b684
Compare
Squashed. I removed some unnecessary bumps from go.mod and go.sum, but other than that the commits are identical to the previous ones. |
Initial release of the fee estimator.
Closes #1412