Skip to content

Conversation

@greenaddress
Copy link

This PR adds a new RPC method called savefeeestimates in a similar fashion to savemempool RPC.

The rational behind this is that currently there is no way to save the fee estimates without shutting down the node and this makes it harder/slower to bring up new instances of bitcoin core.

For example in https://github.com/Blockstream/esplora/ when we do new deployments or when we have higher traffic we need to bring up new instances, currently the procedure uses a snapshot of the blockchain (say a few weeks old) brings it up to the tip, then stops it, calls savemempool on a long running instance, copies that file over and restarts the new node so that the new instance has all the transactions in mempool even though it wasn't live to receive them when they occurred.

However the fee estimation of that new node are not up to date and as such the new node will report bad fee estimates.

This PR will make it possible to start a new node with reasonable fee estimates from an old running node without having to shut down said old running node.

Any feedback welcome and thanks for reviewing/reading.

Copy link
Member

@darosior darosior 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, will review.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

@brunoerg do you mean fee_estimates_persist.py would be a better name or? I used the same as mempool_persist.py but I agree I should add an underscore between fee and estimates

@JeremyRubin
Copy link
Contributor

concept ack; implementation NACK.

IMO the RPC should instead return a JSON format of the fee estimate file which can be paired with a loadfeeestimates rpc on the new node rather than encouraging copying files.

Copy link
Contributor

@lsilva01 lsilva01 left a comment

Choose a reason for hiding this comment

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

tACK ecd40a9 on Ubuntu 20.04.

This current approach solves the problem in similar way to savemempool. Maintaining a pattern of behavior and results between RPC methods is a positive aspect.

Not sure this method should return JSON format, as there's already exist the fee_estimates.dat file to store this information and this would create 2 data structures for the same information.

But I think a follow-up PR can change this file to fee_estimates.json and implement a load RPC based on this JSON. It would maintain a single structure for fee estimates.

src/rpc/misc.cpp Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: The user has no way of knowing where the file will be saved. More information needed.

Copy link
Member

Choose a reason for hiding this comment

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

Seems that's an internal implementation detail?

src/rpc/misc.cpp Outdated
Comment on lines 357 to 359
Copy link
Member

Choose a reason for hiding this comment

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

IMO better to abstract this to fees.cpp

Copy link
Author

Choose a reason for hiding this comment

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

Done, I called the method Write, without parameters - does it make sense to you to overload the method?

Copy link
Member

Choose a reason for hiding this comment

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

No opinion on that

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure this is a good prefix. Maybe feature_feeestimates_persist?

Copy link
Author

Choose a reason for hiding this comment

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

Yep, sounds reasonable, done

@JeremyRubin
Copy link
Contributor

the json format is required for a return value since it's a JSON RPC, but that could just be e.g. a hex encoded string of the file contents.

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 1, 2021

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #24959 (Remove not needed clang-format off comments by MarcoFalke)
  • #13990 (Allow fee estimation to work with lower fees by ajtowns)

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.

@DrahtBot
Copy link
Contributor

🐙 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".

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 1, 2022

There hasn't been much activity lately and the patch still needs rebase. What is the status here?
  • Is it still relevant? ➡️ Please solve the conflicts to make it ready for review and to ensure the CI passes.
  • Is it no longer relevant? ➡️ Please close.
  • Did the author lose interest or time to work on this? ➡️ Please close it and mark it 'Up for grabs' with the label, so that it can be picked up in the future.

@achow101
Copy link
Member

Closing this as it has not had any activity in a while. If you are interested in continuing work on this, please leave a comment so that it can be reopened.

@achow101 achow101 closed this Oct 12, 2022
@bitcoin bitcoin locked and limited conversation to collaborators Oct 12, 2023
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.

8 participants