Remove unused variable assignment #31497

pull yancyribbens wants to merge 1 commits into bitcoin:master from yancyribbens:remove-unused-var-assighnment changing 1 files +0 −1
  1. yancyribbens commented at 3:01 AM on December 14, 2024: contributor

    The variable is conditionally assigned toward the end of the loop and not used after. It's then set back to its default value at the beginning of the loop.

  2. Remove unused variable assignment
    The variable is conditionally assigned toward the end of the loop and
    not used after.  It's then set back to its default value at the beginning
    of the loop.
    b9766c9977
  3. DrahtBot commented at 3:02 AM on December 14, 2024: 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/31497.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

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

  4. theuni commented at 5:18 PM on December 16, 2024: member

    Looks like the same is true for should_shift below. Paging @murchandamus just to make sure those vars are scoped as-intended and that this isn't pointing out a bug.

  5. yancyribbens commented at 5:23 PM on December 16, 2024: contributor

    I don't think the same is true for should_shift. It's last assigned on L505 but that's inside a while loop that depends on the condition of should_shift.

  6. theuni commented at 5:31 PM on December 16, 2024: member

    Ah, of course you're right. I didn't notice that loop condition.

    Sorry for the noise.

  7. yancyribbens commented at 7:17 PM on December 17, 2024: contributor

    Sorry for the noise.

    No problem. It's pretty plain to see that this variable isn't used and can be removed. Not sure if it's worth bugging Murch to look at.

  8. theuni commented at 1:49 PM on December 18, 2024: member

    Sorry for the noise.

    No problem. It's pretty plain to see that this variable isn't used and can be removed. Not sure if it's worth bugging Murch to look at.

    Yes, agreed. I pinged because I thought there was more than 1 instance, which might have pointed out a broken refactor at some point. But yeah, it's pretty clearly just an unnecessary assignment.

    utACK b9766c9977e58a9ebc358d9879576376e76a72b1

  9. hodlinator approved
  10. hodlinator commented at 11:20 AM on December 19, 2024: contributor

    crACK b9766c9977e58a9ebc358d9879576376e76a72b1

    This dead store was a leftover from the introduction of CoinGrinder in 6cc9a46cd0f4ed80d4523bbef1508142e0c80d27 / #27877.

    Checked that there are no shenanigans with the variable being captured into a lambda further up which is then called further down.

  11. maflcko requested review from murchandamus on Dec 19, 2024
  12. danielabrozzoni approved
  13. danielabrozzoni commented at 5:53 PM on December 23, 2024: member

    code review ACK b9766c9977e58a9ebc358d9879576376e76a72b1

  14. murchandamus approved
  15. murchandamus commented at 6:57 PM on December 26, 2024: contributor

    I surmise that I was resetting should_cut in the block that performs the "cut" operation, because performing the cut removes the need for a cut. I agree that the assignment to false is unnecessary, as the variables are recreated at the start of the loop, and starting with fresh variables each loop is easier to parse than instantiating outside of the loop and ensuring whether the flags are cleaned up correctly after each operation.

    ACK b9766c9977e58a9ebc358d9879576376e76a72b1

  16. achow101 commented at 6:06 PM on December 30, 2024: member

    ACK b9766c9977e58a9ebc358d9879576376e76a72b1

  17. achow101 merged this on Dec 30, 2024
  18. achow101 closed this on Dec 30, 2024

  19. yancyribbens commented at 9:34 PM on December 30, 2024: contributor

    Thanks for the reviews.

  20. sedited referenced this in commit 230a439a4a on Jan 17, 2025
  21. stickies-v referenced this in commit d760fd3dda on Mar 17, 2025
  22. stickies-v referenced this in commit cc83553352 on Mar 17, 2025
  23. stickies-v referenced this in commit 2614933f06 on Mar 17, 2025
  24. stickies-v referenced this in commit b70418c5fc on Mar 17, 2025
  25. stickies-v referenced this in commit 69f8a1fe50 on Mar 17, 2025
  26. bug-castercv502 referenced this in commit 44b075fe71 on Sep 28, 2025
  27. bitcoin locked this on Dec 30, 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-25 00:13 UTC

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