validation, zmq: pass block in UpdatedBlockTip to avoid duplicate read #26375

pull andrewtoth wants to merge 2 commits into bitcoin:master from andrewtoth:no-read-zmq changing 13 files +37 −45
  1. andrewtoth commented at 3:18 am on October 24, 2022: contributor
    When CZMQPublishRawBlockNotifier::NotifyBlock is called it calls ReadBlockFromDisk with the passed in block index. However, we will always have already read this block into memory during ActivateBestChain and use it to call BlockConnected. We can check for the tip block there and pass that into UpdatedBlockTip to avoid having the zmq notifier read the block. This also has the benefit of removing the node/blockstorage.h dependency entirely from the zmq code, so we can continue working to remove ReadBlockFromDisk out of global scope (https://github.com/bitcoin/bitcoin/pull/26316#discussion_r1000954807).
  2. validation, zmq: pass block in UpdatedBlockTip to avoid duplicate read 4a164160b6
  3. DrahtBot commented at 10:28 am on October 24, 2022: 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:

    • #26308 (rpc/rest/zmq: reduce LOCK(cs_main) scope: ~6 times as many requests per second by andrewtoth)
    • #15606 (assumeutxo by jamesob)

    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. test: check for zmq block announcements with reorgs 7b631dc9b1
  5. andrewtoth force-pushed on Oct 24, 2022
  6. aureleoules approved
  7. aureleoules commented at 1:37 pm on October 25, 2022: member
    ACK 7b631dc9b1979afc99d9d1a3996492dcb415d3a3 - LGTM
  8. w0xlt approved
  9. maflcko commented at 12:52 pm on November 14, 2022: member
    This will increase the memory use even if not using zmq. I guess it is fine because the queue is limited?
  10. andrewtoth commented at 2:51 am on November 15, 2022: contributor

    This will increase the memory use even if not using zmq. I guess it is fine because the queue is limited?

    That sounds accurate. It seems LimitValidationInterfaceQueue in the loop prevents this from blowing up.

  11. andrewtoth commented at 4:13 pm on November 18, 2022: contributor
    I don’t think this is worth the effort to change anymore. It was a step towards #26316, but I think #26533 is a better way to solve that issue.
  12. andrewtoth closed this on Nov 18, 2022

  13. luke-jr referenced this in commit 20bfdd263e on Jun 28, 2023
  14. luke-jr referenced this in commit bde7a7f9f2 on Jun 28, 2023
  15. luke-jr referenced this in commit 7ac46393a3 on Aug 16, 2023
  16. luke-jr referenced this in commit 2f99fc3629 on Aug 16, 2023
  17. bitcoin locked this on Nov 18, 2023

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-11-17 18:12 UTC

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