Skip to content

Conversation

@famouswizard
Copy link

Description

  • change now always uses Keychain::Internal instead of .last() - avoids random external change or panics when no internal descriptor is present.
  • DrainWeights now matches the change address type (taproot, segwit, legacy) for accurate fee and dust estimates.
  • switched dust comparison from > to >= so exact dust-sized change isn’t lost to fees.

Notes to the reviewers

small but important cleanup for more predictable change handling and fee estimation. Worth double-checking test coverage for non-taproot outputs.

Changelog notice

fix incorrect change keychain selection, fee estimation, and dust threshold comparison.

Checklists

All Submissions:

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

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

Copy link
Contributor

@aagbotemi aagbotemi left a comment

Choose a reason for hiding this comment

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

Great work @famouswizard. I left a comment for your review.

Comment on lines +345 to +350
let drain_weights = match change_desc.witness_version() {
Some(WitnessVersion::V1) => DrainWeights::TR_KEYSPEND,
Some(WitnessVersion::V0) => DrainWeights::WITNESS_V0_KEYSPEND,
None => DrainWeights::LEGACY_KEYSPEND,
_ => DrainWeights::TR_KEYSPEND,
};
Copy link
Contributor

Choose a reason for hiding this comment

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

This code fails to compile due to missing APIs

Copy link
Contributor

@oleonardolima oleonardolima left a comment

Choose a reason for hiding this comment

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

Are you still working on this one ? Please mind @aagbotemi comment above.

@oleonardolima oleonardolima moved this to In Progress in BDK Chain Nov 18, 2025
@oleonardolima oleonardolima added the documentation Improvements or additions to documentation label Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

3 participants