-
Notifications
You must be signed in to change notification settings - Fork 37.7k
fees: skip pointless fee parameter calculation during IBD #22919
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
Can you explain this a bit better? During IBD the mempool should be empty, so the |
Regardless of size of |
See also: |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
cb4cf06
to
edd7d17
Compare
Bitcoin nodes update their TxConfirmStats attributes (eg. confAvg, failAvg etc..) whenever they see a new block. However, during IBD, we know our best block height, so we can skip the parameter updates up to a certain height, when we know they are not going to affect fee estimates. We can see the max value of decay for parameters is .99931. If we do (max_decay)^6048 which is approximate 0.01, it means, that transactions in blocks older than this height, do not affect the current fee estimates significantly. (i.e ~ Best_Block_Height - 6048). By skipping these updates we can reduce the computation complexity of fee calculation during IBD significantly: (block_tree_size - 6048)/block_tree_size*100 which is ~ 99%.
edd7d17
to
39d5312
Compare
🐙 This pull request conflicts with the target branch and needs rebase. Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft". |
There hasn't been much activity lately and the patch still needs rebase. What is the status here?
|
Closing for now. |
Bitcoin nodes update their TxConfirmStats attributes (eg.
confAvg, failAvg
etc..) whenever they see a new block. However, during IBD, we know our best block height, so we can skip the parameter updates up to a certain height, when we know they are not going to affect fee estimates.We can see the max value of decay for parameters is .99931. If we do (max_decay)^6048 which is approximate 0.01, it means, that transactions in blocks older than this height, do not affect the current fee estimates significantly. (i.e ~ Best_Block_Height - 6048).
By skipping these updates we can reduce the computation complexity of fee calculation during IBD significantly: (block_tree_size - 6048)/block_tree_size*100 which is ~ 99%.
I got to know about the functions to optimize by analyzing the profiling data of
bitcoind
. It can be generated via./configure CC=clang CXX=clang++ CXXFLAGS="-fprofile-instr-generate=bitcoind-%p.profraw