Skip to content

Conversation

@ismaelsadeeq
Copy link
Member

@ismaelsadeeq ismaelsadeeq commented Jun 12, 2024

Fixes #30009

This PR changes the estimatesmartfee default mode to economical.

This was also suggested on IRC https://bitcoin-irc.chaincode.com/bitcoin-core-dev/2024-04-26#1021609

  • conservative mode: This is the estimatesmartfee RPC mode which considers a longer history of blocks. It potentially returns a higher fee rate and is more likely to be sufficient for the desired target, but it is not as responsive to short-term drops in the prevailing fee market.
  • economical mode: This is the estimatesmartfee RPC mode where estimates are potentially lower and more responsive to short-term drops in the prevailing fee market.

Since users are likely to use the default mode, this change will reduce overestimation for many users. The conservative mode remains available for those who wish to opt-in.

For an in-depth analysis of how significantly the conservative mode overestimates, see
https://delvingbitcoin.org/t/bitcoind-policy-estimator-modes-analysis/964.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 12, 2024

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK glozow, willcl-ark, instagibbs

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #30079 (Fee Estimation: Ignore all transactions that are CPFP'd by ismaelsadeeq)

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.

Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

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

Concept ACK 5a4a84a6809919561aec46f272f08ae57c0e386e. Slightly surprised no tests need to be changed.

Aside from seeming to overestimate much less, I think "economical" is much closer to what users would expect from a fee estimator. From #10589:

The logic used here is that any time a transaction signals opt-in-RBF and uses automatic fee estimation then it will use the non-conservative estimate. Transactions which do not signal opt-in-RBF will still use the default conservative estimate.

So accuracy of estimates aside, interpreting these settings as:

  • "conservative" = I want to have very high confidence that this feerate is sufficient for my confirmation target, even if it means overestimating
  • "economical" = I want to be reasonably confident about this feerate. I prefer not to overestimate and expect to be able to update it later with a fee-bump if needed

It is pretty normal/default to expect to be able to RBF the transaction later (for example, Core wallet defaults to signaling BIP125 since #25610), so it makes sense that the fee estimation settings should reflect this expectation.

@ismaelsadeeq ismaelsadeeq force-pushed the 06-2024-change-estimatesmartfee-default branch from c308144 to 41a2545 Compare July 18, 2024 11:13
Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

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

ACK 41a2545

Checked that default estimatesmartfee result is using economical.

@achow101 achow101 added this to the 28.0 milestone Jul 18, 2024
@instagibbs
Copy link
Member

concept ACK

could we return a new field that says the mode, then add a test for that to prevent regressions?

@ismaelsadeeq
Copy link
Member Author

Could we return a new field that indicates the mode?

Yes, I plan on addressing this 2ee3d77, in a follow-up PR: as suggested here #30275 (comment) along with some documentation updates proposed in #18217
I will indicate the mode as well in that follow-up

then add a test for that to prevent regressions?

Could you please clarify about the test what specific regressions you're concerned about? Thanks!

@instagibbs
Copy link
Member

Could you please clarify about the test what specific regressions you're concerned about? Thanks!

A boolean flip where the intended behavior isn't followed and we are giving conservative again?

@ismaelsadeeq
Copy link
Member Author

Slightly surprised no tests need to be changed.

Because the fee estimation functional test for estimatesmartfee is not deterministic (transaction fee rates are generated randomly), the check_raw_estimates function tests for a range, ensuring the returned fee rate is reasonable.

A boolean flip where the intended behavior isn't followed and we are conservative again?

I added a simple deterministic test which test the default mode is economical in 307ceb4

@DrahtBot
Copy link
Contributor

🚧 At least one of the CI tasks failed.
Debug: https://github.com/bitcoin/bitcoin/runs/27743833459

Hints

Make sure to run all tests locally, according to the documentation.

The failure may happen due to a number of reasons, for example:

  • Possibly due to a silent merge conflict (the changes in this pull request being
    incompatible with the current code in the target branch). If so, make sure to rebase on the latest
    commit of the target branch.

  • A sanitizer issue, which can only be found by compiling with the sanitizer and running the
    affected test.

  • An intermittent issue.

Leave a comment here, if you need help tracking down a confusing failure.

Copy link
Member

@instagibbs instagibbs left a comment

Choose a reason for hiding this comment

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

better test than what I was asking for, thanks

@ismaelsadeeq ismaelsadeeq force-pushed the 06-2024-change-estimatesmartfee-default branch from 307ceb4 to 48faceb Compare July 22, 2024 14:23
@instagibbs
Copy link
Member

ACK 48faceb

Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

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

Nice test! I just have a few comments

@DrahtBot DrahtBot requested a review from glozow July 24, 2024 10:08
Copy link
Member

@willcl-ark willcl-ark left a comment

Choose a reason for hiding this comment

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

Looks good to me, left a micro style nit if you end up touching to address @glozow 's comments.

It makes sense to default to more economical fee estimation by default, since users can use RBF (or "conservative" estimation) in those cases when it may be required. RBF opt-in has been enabled by default in Bitcoin Core wallets since ~2022 and there is a proposal to enable "full" RBF as default as mempool policy currently open: #30493 (previously #28132)

@ismaelsadeeq ismaelsadeeq force-pushed the 06-2024-change-estimatesmartfee-default branch from 48faceb to b64c7b1 Compare July 24, 2024 14:13
@ismaelsadeeq ismaelsadeeq force-pushed the 06-2024-change-estimatesmartfee-default branch from b64c7b1 to 25bf86a Compare July 24, 2024 14:28
Copy link
Member

@glozow glozow left a comment

Choose a reason for hiding this comment

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

ACK 25bf86a

@DrahtBot DrahtBot requested a review from instagibbs July 24, 2024 16:43
Copy link
Member

@willcl-ark willcl-ark left a comment

Choose a reason for hiding this comment

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

ACK 25bf86a

Looks good to me with those nits fixed 👍🏼

@instagibbs
Copy link
Member

reACK 25bf86a

tests make me feel much better about this thanks

@fanquake
Copy link
Member

Will need a release note.

@fanquake fanquake merged commit f7ab3ba into bitcoin:master Jul 25, 2024
@ismaelsadeeq
Copy link
Member Author

Will need a release note.

Thanks, I will add it in the follow-up!

@ismaelsadeeq ismaelsadeeq deleted the 06-2024-change-estimatesmartfee-default branch July 25, 2024 09:47
@fanquake
Copy link
Member

Release note being added in #30525.

achow101 added a commit that referenced this pull request Aug 7, 2024
fa2f269 [rpc, fees]: add more detail on the fee estimation modes (ismaelsadeeq)
6e7e620 [doc]: add `30275` release notes (ismaelsadeeq)

Pull request description:

  This PR:
  1. Adds release notes for #30275
  2. Describe fee estimation modes in RPC help texts

ACKs for top commit:
  achow101:
    ACK fa2f269
  glozow:
    ACK fa2f269
  willcl-ark:
    ACK fa2f269
  tdb3:
    re ACK fa2f269

Tree-SHA512: b8ea000b599297b954dc770137c29b47153e68644c58550a73e34b74ecb8b65e78417875481efdfdf6aab0018a9cd1d90d8baa5a015e70aca0975f6e1dc9598c
@bitcoin bitcoin locked and limited conversation to collaborators Jul 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change estimate_mode default to "ECONOMICAL" in these RPC calls

8 participants