Skip to content

fix(descriptor): correct index tracking in combinations() function#453

Open
tnull wants to merge 1 commit intobitcoindevkit:masterfrom
tnull:2026-04-fix-combinations-index-bug
Open

fix(descriptor): correct index tracking in combinations() function#453
tnull wants to merge 1 commit intobitcoindevkit:masterfrom
tnull:2026-04-fix-combinations-index-bug

Conversation

@tnull
Copy link
Copy Markdown
Contributor

@tnull tnull commented Apr 23, 2026

Description

The combinations function was pushing new_index (the enumerate index relative to the skipped iterator) instead of index + 1 + new_index (the absolute index in the original vec). This caused duplicate and incorrect combinations to be generated for inputs larger than trivial sizes.

Checklists

All Submissions:

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

@tnull tnull force-pushed the 2026-04-fix-combinations-index-bug branch from 2012f7c to 0dd6d08 Compare April 23, 2026 16:50
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.05%. Comparing base (a9ad3b9) to head (d6bbe77).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #453   +/-   ##
=======================================
  Coverage   80.05%   80.05%           
=======================================
  Files          24       24           
  Lines        5360     5360           
  Branches      244      244           
=======================================
  Hits         4291     4291           
  Misses        990      990           
  Partials       79       79           
Flag Coverage Δ
rust 80.05% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ValuedMammal ValuedMammal moved this to Needs Review in BDK Wallet Apr 30, 2026
@ValuedMammal ValuedMammal added the bug Something isn't working label Apr 30, 2026
@ValuedMammal ValuedMammal added this to the Wallet 3.1.0 milestone Apr 30, 2026
@ValuedMammal ValuedMammal moved this from Needs Review to In Progress in BDK Wallet Apr 30, 2026
The combinations function was pushing `new_index` (the enumerate index
relative to the skipped iterator) instead of `index + 1 + new_index`
(the absolute index in the original vec). This caused duplicate and
incorrect combinations to be generated for inputs larger than trivial
sizes.

Co-Authored-By: HAL 9000
Signed-off-by: Elias Rohrer <dev@tnull.de>
@ValuedMammal ValuedMammal force-pushed the 2026-04-fix-combinations-index-bug branch from 0dd6d08 to d6bbe77 Compare May 1, 2026 00:23
@ValuedMammal
Copy link
Copy Markdown
Collaborator

Rebased

Copy link
Copy Markdown
Collaborator

@ValuedMammal ValuedMammal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK d6bbe77; ran the tests locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants