Skip to content

Conversation

@luke-jr
Copy link
Member

@luke-jr luke-jr commented Nov 25, 2020

Not sure if it makes sense to do this or not...

@DrahtBot
Copy link
Contributor

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

Conflicts

Reviewers, 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.

@kristapsk
Copy link
Contributor

kristapsk commented Nov 26, 2020

I don't think deprecating feerate here so fast is a good idea, as estimatesmartfee is widely used RPC by various software. Maybe just add fee_rate here and deprecate feerate at some point later in the future?

Copy link
Member

@jonatack jonatack 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, 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)"},
Copy link
Member

@jonatack jonatack Nov 26, 2020

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"

@jonatack
Copy link
Member

I don't think deprecating feerate here so fast is a good idea, as estimatesmartfee is widely used RPC by various software. Maybe just add fee_rate here and deprecate feerate at some point later in the future?

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 feerate and fee_rate with different units is not only a bit confusing but also a potential footgun, albeit a hopefully benign one with the 1E5 downward difference between the two units.

@maflcko
Copy link
Member

maflcko commented Nov 26, 2020

What is the benefit of forcing every user to change their scripts when both units can be supported forever at no additional cost?

@jonatack
Copy link
Member

jonatack commented Nov 26, 2020

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 setfeerate RPC in sat/vB (that also aims to provide an improved user experience to encourage its adoption). Could do the same for estimatefeerate.

@sipa
Copy link
Member

sipa commented Nov 26, 2020

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.

@kristapsk
Copy link
Contributor

What is the benefit of forcing every user to change their scripts when both units can be supported forever at no additional cost?

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.

@jonatack
Copy link
Member

jonatack commented Nov 26, 2020

What is the benefit of forcing every user to change their scripts when both units can be supported forever at no additional cost?

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.

@kristapsk
Copy link
Contributor

scripts don't have to change if the deprecation flag is passed on restart after updating to 0.21.

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.

@jonatack
Copy link
Member

jonatack commented Nov 26, 2020

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
}

@kristapsk
Copy link
Contributor

@jonatack , yes that looks ok to me, should not break any properly written software.

@jonatack
Copy link
Member

jonatack commented Nov 27, 2020

Thinking about this more, I propose we:

This seems the best way to:

  • normalize and transition to sat/vB per user demand
  • protect users by not having feeRate/feerate in BTC/kvB and fee_rate in sat/vB in the same RPCs
  • minimize the amount of breaking API changes

@kristapsk
Copy link
Contributor

@jonatack , sounds like a good plan to me!

@jonatack
Copy link
Member

@kristapsk great! I'll do it today.

@luke-jr
Copy link
Member Author

luke-jr commented Nov 27, 2020

I like @jonatack 's plan/approach better, closing.

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 16, 2022
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.

7 participants