-
Notifications
You must be signed in to change notification settings - Fork 38.7k
RPC: Migrate estimatesmartfee return value from "feerate" (BTC/kvB) to "fee_rate" (sat/vB) #20484
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
|
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. |
|
I don't think deprecating |
jonatack
left a comment
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.
Concept ACK, ISTM this is the direction we need to go in for #19543. The last two commits need updated tests/deprecation test.
| { | ||
| {RPCResult::Type::NUM, "feerate", /* optional */ true, "estimate fee rate in " + CURRENCY_UNIT + "/kB (only present if no errors were encountered)"}, | ||
| {RPCResult::Type::NUM, "feerate", /* optional */ true, "estimate fee rate in " + CURRENCY_UNIT + "/kB (only present if no errors were encountered; DEPRECATED, also returned only if the config option -deprecatedrpc=feerate is passed)"}, | ||
| {RPCResult::Type::NUM, "fee_rate", /* optional */ true, "estimate fee rate in " + CURRENCY_ATOM + "/vB (only present if no errors were encountered)"}, |
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.
Would need to also update the help further up, e.g.
+++ b/src/rpc/mining.cpp
@@ -1022,7 +1022,7 @@ static RPCHelpMan submitheader()
static RPCHelpMan estimatesmartfee()
{
return RPCHelpMan{"estimatesmartfee",
- "\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
+ "\nEstimates the approximate fee rate in satoshis per vbyte (" + CURRENCY_ATOM + "/vB) needed for a transaction to begin\n"
"confirmation within conf_target blocks if possible and return the number of blocks\n"
"for which the estimate is valid. Uses virtual transaction size as defined\n"
"in BIP 141 (witness data is discounted).\n",
@@ -1031,7 +1031,7 @@ static RPCHelpMan estimatesmartfee()
{"estimate_mode", RPCArg::Type::STR, /* default */ "CONSERVATIVE", "The fee estimate mode.\n"
" Whether to return a more conservative estimate which also satisfies\n"
" a longer history. A conservative estimate potentially returns a\n"
- " higher feerate and is more likely to be sufficient for the desired\n"
+ " higher fee rate and is more likely to be sufficient for the desired\n"
" target, but is not as responsive to short term drops in the\n"
" prevailing fee market. Must be one of:\n"
I agree, but here are two reasons why deprecating immediately may (a) be acceptable to reviewers and (b) a good idea: (a) I made a similar argument a couple months ago against immediately deprecating the getpeerinfo "addnode" field at the same time as a new field was added to replace it ("addnode": true/false -> "connection_type": "manual"/other string values); reviewers disagreed and preferred to deprecate immediately and have it done with (b) More importantly IMO, having both |
|
What is the benefit of forcing every user to change their scripts when both units can be supported forever at no additional cost? |
Maybe this is answered by (b) in my comment above: confusion, possible footgun. An alternative would be to rename them and add the units in the names, but I think that's sub-optimal if we want to simplify and standardize the naming and units and it would be a breaking change as well. I took another approach with #20391: as settxfee, like estimatesmartfee, is arguably slightly misnamed (they are really about a fee rate, not a fee), I proposed a |
|
If the goal is reducing user confusion rather than due to maintenance burden, we could just make the new fields preferred over the old ones, and e.g. stop listing the old ones in help output. |
That's the approach c-lightning is taking with various calls. This isn't affecting just some scripts, I think this may affect most of the Bitcoin software in existence that relies on Bitcoin Core. And I believe not breaking userspace is very important. |
Remember, the scripts don't have to change if the deprecation flag is passed on restart after updating to 0.21. They have to change only if the code is actually removed later on. The deprecation just hides the fields somewhat similarly to @sipa's suggestion. |
That might only help if Bitcoin Core is bundled into other software, user uses his own scripts or is Bitcoin dev in general. Ordinary user may use Bitcoin Core, c-lightning, JoinMarket and other software relying on Bitcoin Core on his computer, updating everything or parts with OS package manager. They might miss such breaking API changes if they happen so fast, you can't expect everybody to read all the release notes. When more time passes, more software might by updated to use new API and it would be safer to start deprecating old behaviour then. |
|
Ok, to not spend more time on this, please confirm if you think this would be safe and clear. {
"feerate": 0.00078464,
"fee_rate": 78.464,
"blocks": 6
} |
|
@jonatack , yes that looks ok to me, should not break any properly written software. |
|
Thinking about this more, I propose we:
This seems the best way to:
|
|
@jonatack , sounds like a good plan to me! |
|
@kristapsk great! I'll do it today. |
|
I like @jonatack 's plan/approach better, closing. |
Not sure if it makes sense to do this or not...