Skip to content

Conversation

@aagbotemi
Copy link
Collaborator

Description

This PR Implements FeeTarget::AbsoluteFee to allow users to specify exact fee amounts instead of fee rates. This PR fixes #26

Note to the reviewers

The AbsoluteFee variant works by adding the fee amount to the target output value sum and setting the fee rate to ZERO.

All Submissions:

  • I've signed all my commits
  • I followed the conventional commit guidelines
  • I ran cargo fmt before committing
  • I've added tests for the new feature
  • I'm linking the issue being fixed by this PR

@aagbotemi aagbotemi self-assigned this Nov 15, 2025
@aagbotemi aagbotemi added the enhancement New feature or request label Nov 15, 2025
@ValuedMammal
Copy link
Collaborator

ValuedMammal commented Dec 15, 2025

Approach ACK

ACK b6fc87d

@ValuedMammal ValuedMammal merged commit b6fc87d into bitcoindevkit:master Dec 17, 2025
6 checks passed
ValuedMammal added a commit that referenced this pull request Dec 17, 2025
…hangePolicy`

b04db7e refactor(selector): Rename `FeeTarget` to `FeeStrategy` (valued mammal)
33e7a68 example: Rename change_weights to drain_weights (valued mammal)
0cda404 selector!: Remove `SelectorParams::change_weight` (valued mammal)
827cb70 selector!: Swap `ChangePolicyType` for `bdk_coin_select::ChangePolicy` (valued mammal)
bfa2bea example: Fix change spend weight (valued mammal)
b6fc87d feat(selector): implement absolute fee targeting strategy (Abiodun)

Pull request description:

  ## Description

  Fix #29 by removing `ChangePolicyType` from `SelectorParams` in favor of `bdk_coin_select::ChangePolicy`. The idea is that this affords maximum flexibility when defining the change policy.

  Builds on #31 which implements absolute fee targeting. h/t aagbotemi. A test `test_absolute_fee_vs_feerate_target_value` is added that checks the expected `Target` is constructed based on the chosen `FeeStrategy`.

  ## Changelog

  ### Added

  - selector: Added `FeeStrategy` enum which defines the fee target as either a feerate or fee amount.

  ### Changed

  **BREAKING**

  - `SelectorParams::target_feerate` field is changed to `fee_strategy`.
  - `SelectorParams::change_policy` field is changed to have type `bdk_coin_select::ChangePolicy`.
  - `SelectorParams::new` is changed to accept the `fee_strategy` and `change_policy` as inputs.

  ### Removed

  - `SelectorParams::change_weight` field is removed now that the change weights are represented in the actual change policy.
  - Removed `SelectorParams::to_cs_change_policy` as the conversion is no longer necessary.
  - Removed `ChangePolicyType` enum to allow the user to construct the intended `ChangePolicy`.

ACKs for top commit:
  aagbotemi:
    ACK b04db7e

Tree-SHA512: 8c4ca2c80c9bb10381a63f34a2fd18f0e75cea343cc0161439d4eb3e0d3ec8a8f252ea35914151fef5b5b21acbafcd856e1b36d88bd084f003225fe770ce6611
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Is there a way to specify the absolute fee of a transaction?

2 participants