Skip to content

Conversation

darosior
Copy link
Member

@darosior darosior commented Apr 25, 2020

If the blocksonly mode is turned on after running with transaction
relay enabled for a while, the fee estimation will serve outdated data
to both the internal wallet and to external applications that might be
feerate-sensitive and make use of estimatesmartfee (for example a
Lightning Network node).

This has already caused issues (for example #16840 (C-lightning), or lightningnetwork/lnd#2562 (LND)) and it seems prudent to fail rather than to give inaccurate values.

This fixes #16840, and closes #16890 which tried to fix the symptoms (RPC) but not the cause as mentioned by sdaftuar :

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!).

@DrahtBot DrahtBot added the Tests label Apr 25, 2020
@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 25, 2020

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.

@darosior darosior force-pushed the disable_feeest_blocksonly branch from 9cf5c47 to 33ca359 Compare April 27, 2020 10:18
@darosior
Copy link
Member Author

@promag : addressed your feedback. Would be interested about what do you think about disabling the fee estimation in blocksonly conceptually though.

@luke-jr
Copy link
Member

luke-jr commented Apr 30, 2020

Concept ACK / Sounds reasonable.

@brakmic
Copy link
Contributor

brakmic commented May 1, 2020

Concept ACK.

@laanwj
Copy link
Member

laanwj commented May 4, 2020

Concept ACK, but I don't know enough about the underlying mechanism to be sure if this is a reasonable way to accomplish it.

@promag
Copy link
Contributor

promag commented May 4, 2020

Would be interested about what do you think about disabling the fee estimation in blocksonly conceptually though.

Same opinion as above.

@maflcko
Copy link
Member

maflcko commented May 4, 2020

Concept ACK, while the fee estimation should work for some limited time after the mempool has been turned off (see #16840 (comment)), I can see the point to fail early on startup instead of later at runtime.

@maflcko
Copy link
Member

maflcko commented May 4, 2020

Concept ACK 33ca359

luke-jr pushed a commit to bitcoinknots/bitcoin that referenced this pull request Jun 9, 2020
If the 'blocksonly' mode is turned on after running with transaction
relay enabled for a while, the fee estimation will serve outdated data
to both the internal wallet and to external applications that might be
feerate-sensitive and make use of 'estimatesmartfee' (for example a
Lightning Network node).

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>

Github-Pull: bitcoin#18766
Rebased-From: 33ca359
@darosior
Copy link
Member Author

@sdaftuar (ping because you reviewed the previous PR) : what do you think of this approach compared to the previous one ?

@morcos (ping because you implemented the fee estimation) : what do you think of it implementation-wise ?

@maflcko maflcko mentioned this pull request Jul 19, 2020
@darosior darosior force-pushed the disable_feeest_blocksonly branch from 33ca359 to d6c1115 Compare July 29, 2020 16:14
@darosior
Copy link
Member Author

This was intended to be a "quick fix", but the approach seems to be too much of a workaround.

I've reworked this to opt for a more involved approach based on #19556. This now:

  • Removes the fee estimator related globals.
  • Conditionally creates the fee estimator: if we don't relay transactions we don't even bother to allocate the CBlockPolicyEstimator.

This is rebased on top of #19556 (which i itself rebased on top of #19604).

Copy link
Member

@maflcko maflcko 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 cc21167 🚟

Show signature and timestamp

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Concept ACK cc21167415aa01db862035cd07b6b9b35fb53f35  🚟
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUilvAv/d0DZXa+aEjrm/fPzFOmqe/7bGZZTctNR8VQxeQ8DE+Ft7Q7zWo4bvHYl
YeB42SZeTofhU5+ICOGsmxytQ52FA0bPvOJXGH/8zQ6wIvrdTxAhjt5MP3YunOy9
mt8qOOMtLi/RybMV4VgEPDqYZRz27s6LuUxgbgK8YJ5q981pp15LhQ5e0Au4duU0
MQfqwZIqV7L7H5DEcLo/VeN4hVurII5vLg3PK1a56APtW2MKi4lPx5kS17TuAZY5
12kew9JuoaGVrAJKHHzXme0Q+yCwOgptZ1rVEhEYsB11aRG9kkThXvO+oo+oPtc6
SdcGtilVdnfE6x/VNEiD7VTxWgbQ5BUUAPoAoWIrOMDsWB15rcw/dtlAXoHF8JFR
pOJUCK4racs+TPjfwGtAVpjBmqiebzZFNIRPjizMDCKmxEnMCLNNX2l3jR3U3x8M
ObOSwoIIF8W384rupBCjF2+aVnmOsJ2ktx8AFdoNX1NdAs81f0NIfOyoW4hfOl4N
7l5DRdLQ
=6uOX
-----END PGP SIGNATURE-----

Timestamp of file with hash b08551e34b42f9bb8f8e283ece496e30ae7d418c171ecf636076b60c63a83df6 -

@jnewbery
Copy link
Contributor

jnewbery commented Dec 1, 2020

utACK 01e3998

Copy link
Member

@maflcko maflcko left a comment

Choose a reason for hiding this comment

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

left some style nits. Let me know if you want to fix them or get this merged instead.

review ACK 01e3998 🐪

Show signature and timestamp

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

review ACK 01e39989f23b26a23cea26e5ec4d8dfc2010bc97 🐪
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUhJMgwAwnGF/r7ezo/CimEvIuOfeD6LzJ7NDb6SHs5vwyofUN2w8UojfZ7MxuQV
9kGtWH4oHtzNU5732r2HYPfAGWZI6iJe8HAnZY5fjzC0KoN8PLY2DJ97lS9/rWnb
5Dco0RD4r+g0ZVFnN+mfMrQ47nmDHCiULNP0nbav40iXlWS8IQiZiNNJVKInW0q7
w5M3e3I1Np2PQ3lEMqMJ4An2Dt+WAtHLeA9OYB4b0yoXIc4JtYiiQ/mrogEqkAv/
tWal6S7ElJGmuL+/ceXNg6xXqvKpPT6U4yNxcKR9s/ceyhEngaOt7EmDWWRVVXt7
PkV29eLM4TYmPbasK6dIUei2q+xtDWjzKFgAuMe83+kWDyb8+oqNxZi140xHVG2P
AYlbfKD4JnoGB32tEfzgh/Z9dQj4xG+mWhLYL8I7oUDU/SkC3blBmpwPiSHxmvA8
NWabgQshHcDeKWiw3GpZs6BbMjI6xJnq9Dq8kOmYX5Hz6uT3mIJ76KN31WRHFUfC
6kbMbc1m
=5+en
-----END PGP SIGNATURE-----

Timestamp of file with hash 532e63b9bee4dd7e9da189eb2890bcc77d9c1f37ba300a2a322c9d027b0c9158 -

@darosior darosior force-pushed the disable_feeest_blocksonly branch from 01e3998 to 34250a1 Compare December 3, 2020 11:03
@darosior
Copy link
Member Author

darosior commented Dec 3, 2020

Addressed all @MarcoFalke 's remaining nits.

@practicalswift
Copy link
Contributor

Concept ACK

@darosior darosior force-pushed the disable_feeest_blocksonly branch 2 times, most recently from 9775dd7 to 8547afd Compare December 3, 2020 11:41
darosior and others added 4 commits December 3, 2020 12:56
Co-Authored-by: MarcoFalke <falke.marco@gmail.com>
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
This moves the CBlockPolicyEstimator to the NodeContext, which get rids
of two globals and allows us to conditionally create the
CBlockPolicyEstimator (and to remove a circular dep).

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
…ions

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
This moves the fee_estimates file management to the CBlockPolicyEstimator
Flush() method.

Co-authored-by: John Newbery <john@johnnewbery.com>
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
@maflcko
Copy link
Member

maflcko commented Dec 7, 2020

re-ACK 4e28753 👋
only changes:

  • Small test fixup (restart_node)
  • Small log fixups
  • Remove dead code (empty path check)
Show signature and timestamp

Signature:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

re-ACK 4e28753f60 👋
only changes:
* Small test fixup (restart_node)
* Small log fixups
* Remove dead code (empty path check)
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUiivwwAvP/ngY1HjLgcIUIL6koFzy3aWPRMQhVCyB4gj6n7rHQoETxZZKMrgk4Z
soRCvS8dCX1B9OMgJ7B4iBcyX2ywfw7nAA4PwUSPMJLbNitqzPkpxuG1RNLtLfwt
4loau6a5ZZJlKYhLoR8Q6NEdYwCC/OfpZYRIjlQd2+waGdaki1/G86Q6LKGe5xAZ
TM4VW89RpnHofXm5zxJZq3CiUExZMMSGVMwp+4eGpk0h9/eeYoKr1IGFh7qGzTSe
X5U/t5z6EmygD3gL1QaVWSb73TTeaU2Iux3U7JR9pYJgK4dNjZr3WKTCY7NJORqv
kCcW3ZHL4E3w8Oz9hnU6uSHsj+xOONTRxffHzsP7e1nkYTRSqEjqAohO1u2jL0Ho
2FSyXyDtp2uC0mn64JW0duVZI88FT6fRqyt/HiUHvnFzLSdTg90mDMtWMF/qQcb2
jXpEvjaKGI129CgdlHRxVpUFmAK6bOdHxrx9fgcwD1L6hHo1PQX8N59ulLP2uano
g2unQ65X
=AMhQ
-----END PGP SIGNATURE-----

Timestamp of file with hash 3d9e3dc48bc4d73872a862f7eccfe39d2af942484475d2f8af25b52833aa2031 -

@jnewbery
Copy link
Contributor

jnewbery commented Dec 7, 2020

utACK 4e28753

@maflcko maflcko merged commit 03b1db6 into bitcoin:master Dec 7, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 7, 2020
@darosior darosior deleted the disable_feeest_blocksonly branch January 12, 2021 21:41
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Mar 15, 2022
Summary:
Remove unused method and move variable initialization in init.cpp

This is a partial backport of [[bitcoin/bitcoin#18766 | core#18766]]

The pull request is mostly not applicable to Bitcoin ABC. The variable moved in init.cpp are just to keep close to the source material and make future backports easier to review.

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D11169
@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.

fee estimate should be disabled with blocksonly mode