threading: reduce the scope of lock in getblocktemplate #33264

pull kevkevinpal wants to merge 1 commits into bitcoin:master from kevkevinpal:reduceScopeOfGetBlockTemplateLock changing 1 files +5 −3
  1. kevkevinpal commented at 1:20 AM on August 28, 2025: contributor

    This change was motivated by #32592 (review)

    It does exactly what is said in the comment. Reducing the scope of the lock by a bit before it is needed

  2. DrahtBot commented at 1:20 AM on August 28, 2025: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33264.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK stickies-v, maflcko

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  3. maflcko commented at 6:13 AM on August 28, 2025: member

    lgtm ACK 06ec4809045f5cbe51d54e8eda08db03ca4d5ca1

  4. in src/rpc/mining.cpp:735 in 06ec480904 outdated
     731 | @@ -734,6 +732,7 @@ static RPCHelpMan getblocktemplate()
     732 |              if (!DecodeHexBlk(block, dataval.get_str()))
     733 |                  throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
     734 |  
     735 | +            LOCK(cs_main);
    


    stickies-v commented at 11:08 AM on August 28, 2025:

    nit: could be one line lower to reduce scope more


    kevkevinpal commented at 12:43 PM on August 28, 2025:

    Makes sense to me! updated in 493ba0f

  5. stickies-v approved
  6. stickies-v commented at 11:18 AM on August 28, 2025: contributor

    ACK 06ec4809045f5cbe51d54e8eda08db03ca4d5ca1

  7. threading: reduce the scope of lock in getblocktemplate 493ba0f688
  8. kevkevinpal force-pushed on Aug 28, 2025
  9. stickies-v commented at 1:27 PM on August 28, 2025: contributor

    re-ACK 493ba0f688311280056491986068cd4a9ad2be66

  10. DrahtBot requested review from maflcko on Aug 28, 2025
  11. maflcko commented at 1:47 PM on August 28, 2025: member

    lgtm ACK 493ba0f688311280056491986068cd4a9ad2be66

  12. fanquake merged this on Aug 28, 2025
  13. fanquake closed this on Aug 28, 2025

  14. alexanderwiederin referenced this in commit 49e068b15b on Sep 16, 2025
  15. alexanderwiederin referenced this in commit 4b0c2f2a8f on Sep 17, 2025
  16. alexanderwiederin referenced this in commit 2edb618ffe on Sep 17, 2025
  17. stringintech referenced this in commit fb8510ba20 on Sep 17, 2025
  18. bug-castercv502 referenced this in commit 9f5d12d027 on Sep 28, 2025
  19. yuvicc referenced this in commit d89c6d0002 on Sep 28, 2025
  20. stickies-v referenced this in commit a785fe6759 on Nov 5, 2025
  21. Kino1994 referenced this in commit fa21c593df on Jun 28, 2026
  22. BigcoinBGC referenced this in commit add55bf585 on Jun 30, 2026
  23. Kino1994 referenced this in commit 1f19b2adfe on Aug 19, 2026
  24. bitcoin locked this on Aug 28, 2026

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: 2026-09-06 08:51 UTC

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