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


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-04-15 15:12 UTC

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