test: check Knapsack skips overweight groups #36840

pull Naomi-Gift wants to merge 1 commits into bitcoin:master from Naomi-Gift:test-knapsack-skip-overweight changing 1 files +19 −0
  1. Naomi-Gift commented at 6:59 PM on November 11, 2026: none

    Adds a test to check that Knapsack skips overweight groups and continues checking the remaining groups.

    Mutant: Knapsack selection loop

    if (group.m_weight > max_selection_weight) {
        max_weight_exceeded = true;
    -   continue;
    +   break;
    }
    

    I found this mutant on the mutation testing dashboard and confirmed it still survives on current master by applying it and running the five wallet test suites. All five passed with the mutant.

    With this mutant, the loop stops at an overweight group instead of skipping it, potentially missing valid groups later in the list. The test uses 10 overweight groups and one valid group. Since Knapsack shuffles groups randomly, it runs several times so that in some runs, overweight groups come before the valid one. The test passes on master and fails with the mutant applied, producing critical check result has failed.

  2. test: check Knapsack skips overweight groups 31e82df254
  3. DrahtBot added the label Tests on Nov 11, 2026
  4. DrahtBot commented at 6:59 PM on November 11, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36255 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36255.svg"></sub> (Refactor CoinGrinder tests by murchandamus)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. DrahtBot added the label CI failed on Nov 14, 2026
  6. DrahtBot commented at 8:06 PM on November 14, 2026: contributor

    <!--85328a0da195eb286784d51f73fa0af9-->

    🚧 At least one of the CI tasks failed. <sub>Task tidy: https://github.com/bitcoin/bitcoin/actions/runs/43082997454/job/132532220555</sub> <sub>LLM reason (✨ experimental): CI failed because clang-tidy treats inefficient push_back inside a loop in wallet/test/coinselection_tests.cpp:272 as an error.</sub>

    <details><summary>Hints</summary>

    Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:

    • Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.

    • A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.

    • An intermittent issue.

    Leave a comment here, if you need help tracking down a confusing failure.

    </details>


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-11-18 16:51 UTC

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