test: Perform full reset of CoinsResult in order to avoid passing 21M BTC #35456

pull hodlinator wants to merge 3 commits into bitcoin:master from hodlinator:2026/06/camount_gifts_2 changing 7 files +15 −20
  1. hodlinator commented at 7:33 AM on June 4, 2026: contributor

    The knapsack_solver_test in coinselector_tests.cpp was accumulating satoshi amounts beyond 21M BTC. This was uncovered while experimenting with adding checks to CAmount. Fix that by fully resetting the CoinsResult object accumulating those amounts, inspired by #35449 (comment).

    Also, while we're at it, add 2 commits which correct some int64_t/CAmount confusion.

    Fixes https://github.com/bitcoin/bitcoin/issues/35449

  2. wallet: Remove CoinsResult::Clear()
    Instead we fully reset CoinsResult-instances without forgetting any fields.
    
    Fixes: https://github.com/bitcoin/bitcoin/issues/35449
    
    Variant resetting the other fields in Clear():
    ₿ hyperfine --warmup 2 "./build/bin/test_bitcoin -t coinselector_tests/knapsack_solver_test"
    Benchmark 1: ./build/bin/test_bitcoin -t coinselector_tests/knapsack_solver_test
      Time (mean ± σ):      4.289 s ±  0.008 s    [User: 4.252 s, System: 0.027 s]
      Range (min … max):    4.279 s …  4.301 s    10 runs
    
    This variant:
    ₿ hyperfine --warmup 2 "./build/bin/test_bitcoin -t coinselector_tests/knapsack_solver_test"
    Benchmark 1: ./build/bin/test_bitcoin -t coinselector_tests/knapsack_solver_test
      Time (mean ± σ):      4.279 s ±  0.005 s    [User: 4.244 s, System: 0.026 s]
      Range (min … max):    4.271 s …  4.287 s    10 runs
    b5e91e946c
  3. refactor(test): Make CAmount arg explicit for BuildCreditingTransaction() 43ca54ca00
  4. rpc+bitcoin-tx: Specify correct type for ParseFixedPoint() d0b76c7f3e
  5. DrahtBot added the label Tests on Jun 4, 2026
  6. DrahtBot commented at 7:34 AM on June 4, 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/35456.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK sedited, furszy, brunoerg

    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-->

  7. sedited approved
  8. sedited commented at 7:54 AM on June 4, 2026: contributor

    ACK d0b76c7f3e6a7f258f9f704087e394d9cf8372e6

  9. furszy commented at 1:09 PM on June 4, 2026: member

    utACK d0b76c7f3e6a7f258f9f704087e394d9cf8372e6

  10. sedited requested review from murchandamus on Jun 4, 2026
  11. brunoerg approved
  12. brunoerg commented at 6:14 PM on June 8, 2026: contributor

    code review ACK d0b76c7f3e6a7f258f9f704087e394d9cf8372e6

  13. sedited merged this on Jun 8, 2026
  14. sedited closed this on Jun 8, 2026

  15. alexanderwiederin referenced this in commit b95c2a40c5 on Jun 24, 2026
  16. sedited referenced this in commit d0f9ae934c on Jun 25, 2026
  17. Kino1994 referenced this in commit 76d6d69023 on Jun 28, 2026
  18. yuvicc referenced this in commit 75e21edcc5 on Jun 29, 2026
  19. Kino1994 referenced this in commit 5373e09b1d on Aug 19, 2026
  20. hodlinator deleted the branch on Sep 21, 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-23 13:51 UTC

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