contrib: Fix NameError in signet miner gbt() #35044

pull torkelrogstad wants to merge 1 commits into bitcoin:master from torkelrogstad:2026-04-10-signet changing 1 files +1 −1
  1. torkelrogstad commented at 8:25 AM on April 10, 2026: contributor

    The logging.warning call referenced bci["bestblockhash"], a variable from the calling scope do_generate() that is not available inside the Generate.gbt() method. This would crash with a NameError when getblocktemplate returned a template based on an unexpected previous block.

    Use the bestblockhash parameter that was already being passed in and used correctly in the comparison on the line above.

    The bug was introduced in 7b31332370 when the gbt logic was extracted into its own method — the if-condition was updated but the logging call was not.

  2. contrib: Fix NameError in signet miner gbt()
    The logging.warning call referenced `bci["bestblockhash"]`, a variable
    from the calling scope `do_generate()` that is not available inside the
    `Generate.gbt()` method. This would crash with a NameError when
    getblocktemplate returned a template based on an unexpected previous
    block.
    
    Use the `bestblockhash` parameter that was already being passed in and
    used correctly in the comparison on the line above.
    
    The bug was introduced in 7b31332370 when the gbt logic was extracted
    into its own method — the if-condition was updated but the logging
    call was not.
    701bc2dc02
  3. DrahtBot added the label Scripts and tools on Apr 10, 2026
  4. DrahtBot commented at 8:25 AM on April 10, 2026: 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/35044.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK sedited, kevkevinpal

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. sedited approved
  6. sedited commented at 11:45 AM on April 20, 2026: contributor

    ACK 701bc2dc02f73a10498ecf70c5d3523e0bb6b953

  7. kevkevinpal commented at 6:22 PM on May 9, 2026: contributor

    ACK 701bc2d

    By reading the if statement and the warning message, it makes sense that we should output bestblockhash instead of bci["bestblockhash"] for two reasons

    1. bci["bestblockhash"] is out of scope
    2. in the if statement is checking for bestblockhash
  8. sedited merged this on May 13, 2026
  9. sedited closed this on May 13, 2026

  10. fanquake referenced this in commit 0449061877 on May 15, 2026
  11. fanquake commented at 12:52 PM on May 15, 2026: member

    Backported to 31.x in #35231.


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-05-19 06:51 UTC