Introduce waitFeesChanged() mining interface #30443

pull Sjors wants to merge 1 commits into bitcoin:master from Sjors:2024/07/mining-fees-changed changing 2 files +36 −0
  1. Sjors commented at 3:34 pm on July 12, 2024: member

    This adds waitFeesChanged() to the Mining interface.

    The Stratum v2 protocol allows pushing out templates as fees in the mempool increase. This interface lets us know when it’s time to do so.

    Without Cluster Mempool however the implementation is “fake”, instead returning every time a transaction is added to the mempool. So for now I’m keeping this draft. It’s here to provide a complete and stable Mining interface for #30437 to build on.

    Unlike the entire Mining interface so far, this is not a refactor. It adds new functionality.

    The current implementation is very similiar to how longpolling in getblocktemplate works, which checks getTransactionsUpdated every 10 seconds.

    However once Cluster Mempool is added it will be cheap enough to frequently generate a block template, check if the fees have gone up enough and then return. That would cause a behaviour change if getblocktemplate were to use waitFeesChanged(), which is why this PR does not touch the longpolling code.

    TODO:

    • try with (draft) cluster mempool branch
  2. DrahtBot commented at 3:34 pm on July 12, 2024: contributor

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

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #30437 (multiprocess: add bitcoin-mine test program by ryanofsky)
    • #30409 (Introduce waitTipChanged() mining interface, replace RPCNotifyBlockChange and drop CRPCSignals by Sjors)
    • #29432 (Stratum v2 Template Provider (take 3) by Sjors)

    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.

  3. Sjors force-pushed on Jul 15, 2024
  4. Sjors force-pushed on Jul 15, 2024
  5. Sjors force-pushed on Jul 15, 2024
  6. ryanofsky referenced this in commit 4e1a4342f3 on Jul 16, 2024
  7. ryanofsky referenced this in commit e1ae38f4bb on Jul 17, 2024
  8. ryanofsky referenced this in commit e1fa475a5b on Jul 17, 2024
  9. ryanofsky referenced this in commit 5126ac430f on Jul 17, 2024
  10. ryanofsky referenced this in commit bdd68d5bca on Jul 17, 2024
  11. Sjors referenced this in commit 173580b123 on Jul 17, 2024
  12. Sjors referenced this in commit 7967d78d73 on Jul 18, 2024
  13. Sjors referenced this in commit 79336c95fa on Jul 18, 2024
  14. Sjors commented at 4:06 pm on July 18, 2024: member

    @sdaftuar @sipa I made a branch sv2-cluster that combines #28676 with #29432:

    The main commit is https://github.com/bitcoin/bitcoin/commit/f646977ddac0622889d484683ae59c262d50d8dc. It slightly changes the waitFeesChanged() interface. The implementation now frequently creates a new template.

    The Template Provider then uses that to see if sending a new NewTemplate message is justified.

    It still takes 20-30ms on mainnet to create a template, without or the cluster mempool changes. I guess BlockAssembler::CreateNewBlock doesn’t actually take advance of it? How would I go about getting the total fees for the first block?

    It doesn’t have to be very precise. The user can configure -sv2delta as a threshold for when to send out new templates, but we can be off by a bit. The actual block is constructed later.

  15. Sjors force-pushed on Jul 18, 2024
  16. Sjors commented at 4:54 pm on July 18, 2024: member
    Rebased after #30356 landed. Changed fees_before to be a reference to CAmount based on the above experience of using it.
  17. ryanofsky referenced this in commit 8a814d5f93 on Jul 18, 2024
  18. ryanofsky referenced this in commit fba04d7756 on Jul 18, 2024
  19. ryanofsky referenced this in commit 0b76ed6480 on Jul 18, 2024
  20. ryanofsky referenced this in commit b01bf642b7 on Jul 18, 2024
  21. Introduce waitFeesChanged() mining interface 57e89084e7
  22. Sjors force-pushed on Jul 19, 2024
  23. Sjors commented at 8:56 am on July 19, 2024: member
    Added bool& tip_changed.
  24. Sjors referenced this in commit 01bc77e850 on Jul 19, 2024
  25. Sjors referenced this in commit ab18e9ce3d on Jul 19, 2024
  26. Sjors commented at 8:28 am on July 22, 2024: member

    I’m moving this to https://github.com/Sjors/bitcoin/pull/52.

    Since it’s astronomically unlikely multiprocess will be in the upcoming v28.0 release, we have at least half a year to flesh out this interface. Hopefully cluster mempool will be further along by then, since that will inform the design.

  27. Sjors closed this on Jul 22, 2024

  28. ryanofsky referenced this in commit ec5f45b918 on Jul 24, 2024
  29. ryanofsky referenced this in commit 257cc06e87 on Jul 24, 2024
  30. ryanofsky referenced this in commit 35b80d2260 on Jul 24, 2024
  31. Sjors referenced this in commit 1758b5d2b4 on Aug 13, 2024
  32. Sjors referenced this in commit 27630ec524 on Aug 13, 2024
  33. ryanofsky referenced this in commit 4d077f17de on Sep 6, 2024
  34. Sjors reopened this on Sep 24, 2024

  35. Sjors closed this on Sep 24, 2024


Sjors DrahtBot


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-12-22 03:12 UTC

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