selector!: Swap ChangePolicyType for bdk_coin_select::ChangePolicy#32
Merged
ValuedMammal merged 6 commits intobitcoindevkit:masterfrom Dec 17, 2025
Merged
Conversation
The spend weight now accounts for both the weight of a default `TxIn` as well as the expected satisfaction weight.
This is redundant now that SelectorParams holds the ChangePolicy directly.
The name "strategy" is better suited for the enum, as it implies different strategies can be used, and helps to disambiguate from other similarly named types `Target` and `TargetFee`, etc.
71169fd to
b04db7e
Compare
ChangePolicyType for bdk_coin_select::ChangePolicy
Collaborator
Author
|
Rebased on #31. |
evanlinjin
reviewed
Feb 17, 2026
Comment on lines
+176
to
+179
| TargetFee { | ||
| rate: bdk_coin_select::FeeRate::ZERO, | ||
| replace: self.replace.as_ref().map(|r| r.to_cs_replace()), | ||
| } |
Member
There was a problem hiding this comment.
This looks like abusing the API. The underlying crate bdk_coin_select does not support coin selection purely with an absolute fee target.
This may result in unexpected behavior if paired with RBF. The Replace struct would still enforce incremental relay fee requirements, but the zero feerate means the selector wouldn't try to meet the original tx's feerate floor (feerate_lb is ignored). So you could end up with a replacement that satisfies BIP125 rule 4 (absolute fee) but not rule 6 (feerate), or vice versa.
If this feature is needed, we should upstream the changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix #29 by removing
ChangePolicyTypefromSelectorParamsin favor ofbdk_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_valueis added that checks the expectedTargetis constructed based on the chosenFeeStrategy.Changelog
Added
FeeStrategyenum which defines the fee target as either a feerate or fee amount.Changed
BREAKING
SelectorParams::target_feeratefield is changed tofee_strategy.SelectorParams::change_policyfield is changed to have typebdk_coin_select::ChangePolicy.SelectorParams::newis changed to accept thefee_strategyandchange_policyas inputs.Removed
SelectorParams::change_weightfield is removed now that the change weights are represented in the actual change policy.SelectorParams::to_cs_change_policyas the conversion is no longer necessary.ChangePolicyTypeenum to allow the user to construct the intendedChangePolicy.