rpc: Don’t allow to ’estimatesmartfee’ in blocksonly mode #16890

pull darosior wants to merge 1 commits into bitcoin:master from darosior:estimatesmartfee_blockonly changing 3 files +12 −1
  1. darosior commented at 10:25 pm on September 16, 2019: member

    Fixes #16840.

    EDIT: some context from the issue: estimatesmartfee will return bad (outdated) fee estimation if ran in blocksonly mode. Seems better for it to fail instead of succeeding with potentially harmful (in the case of a lightning penalty tx for example) values.

  2. fanquake added the label RPC/REST/ZMQ on Sep 16, 2019
  3. DrahtBot commented at 0:55 am on September 17, 2019: member

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #18530 (Add test for -blocksonly and -whitelistforcerelay param interaction by glowang)

    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.

  4. in src/rpc/mining.cpp:833 in 33cb347a6b outdated
    829@@ -830,6 +830,9 @@ static UniValue estimatesmartfee(const JSONRPCRequest& request)
    830         if (fee_mode == FeeEstimateMode::ECONOMICAL) conservative = false;
    831     }
    832 
    833+    if (!g_relay_txes)
    


    promag commented at 7:24 am on September 17, 2019:
    nit, add braces or single line.
  5. promag commented at 7:25 am on September 17, 2019: member
    Mind adding a small release note?
  6. sdaftuar commented at 1:18 pm on September 17, 2019: member

    I’m not sure I understand the thinking here – should we also disallow transacting if in blocksonly mode? It’s not clear to me that hiding the fee estimation results but allowing the wallet to transact is a useful user experience.

    I see the original issue has to do with a lightning wallet that is using our fee estimates under the hood; perhaps we should instead expose the blocksonly setting via an rpc call (if we’re not doing it already) and the lightning wallet can decide how to handle the configuration?

  7. darosior commented at 4:24 pm on September 17, 2019: member

    I’m not sure I understand the thinking here – should we also disallow transacting if in blocksonly mode? It’s not clear to me that hiding the fee estimation results but allowing the wallet to transact is a useful user experience.

    Since the estimatesmartfee command returns an estimation based on relayed transaction, if we don’t relay (or rather stop relaying) the estimation will be wrong (based on the last relayed transactions). This change assumes that it’s wise to return an error instead of a wrong information.

    I see the original issue has to do with a lightning wallet that is using our fee estimates under the hood;

    Yes (C-lightning) and it assumes that the estimation is accurate (or rather not very inaccurate).

    perhaps we should instead expose the blocksonly setting via an rpc call (if we’re not doing it already) and the lightning wallet can decide how to handle the configuration?

    I think this should be handled on our side as we expose an inaccurate information.

  8. RPC: restrict access to 'estimatesmartfee' in blocksonly mode f53a81583e
  9. darosior force-pushed on Sep 17, 2019
  10. sdaftuar commented at 4:51 pm on September 17, 2019: member

    I think this should be handled on our side as we expose an inaccurate information.

    If this is a substantial problem, then I would think we should take action to protect our own wallet users as well (rather than hide the results of what our fee estimation would do!).

  11. darosior commented at 8:48 pm on September 17, 2019: member

    Yes that’s preferable and also what I wanted to do instead of this PR. However I don’t see how we could give an accurate estimation without an updated mempool ? If you have an idea I’d be happy to work on this.

    I thought about median fees in the last n blocks but in the case that a lot of transactions are mined with unnecessary high fees that would give inaccurate estimation and contribute to a global fee increase. Or maybe I miss something ?

  12. fanquake renamed this:
    JSONRPC: Don't allow to 'estimatesmartfee' in blocksonly mode
    rpc: Don't allow to 'estimatesmartfee' in blocksonly mode
    on Sep 17, 2019
  13. promag commented at 1:52 pm on September 18, 2019: member

    However I don’t see how we could give an accurate estimation without an updated mempool

    Could just fail? There’s already the error “Insufficient data or no feerate found” so looks like we could add “Expired data” or something like that - this would affect wallets too.

  14. darosior commented at 4:04 pm on September 18, 2019: member

    However I don’t see how we could give an accurate estimation without an updated mempool

    Could just fail? There’s already the error “Insufficient data or no feerate found” so looks like we could add “Expired data” or something like that - this would affect wallets too.

    Yes, that’s why I ended up submitting this :-)

  15. laanwj added the label Needs Conceptual Review on Sep 30, 2019
  16. DrahtBot commented at 2:17 pm on May 21, 2020: member

    🐙 This pull request conflicts with the target branch and needs rebase.

  17. DrahtBot added the label Needs rebase on May 21, 2020
  18. jnewbery commented at 8:59 am on September 29, 2020: member
    Should this be closed? I think it’s no longer needed now that #18766 is open.
  19. darosior commented at 9:01 am on September 29, 2020: member

    Absolutely, i thought i added a magical “closes xxx” link in #18766 .

    Anyways, thanks for the reminder!

  20. darosior closed this on Sep 29, 2020

  21. MarcoFalke referenced this in commit 03b1db6114 on Dec 7, 2020
  22. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-01 13:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me