-
Notifications
You must be signed in to change notification settings - Fork 7
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Original discussion: bitcoindevkit/bdk#1072 (comment)
@jp1ac4 @darosior I'm working on some breaking changes to the API.
After a discussion with @LLFourn, we've decided to include DrainWeights in Target and keep Target in the CoinSelector. This simplifies the API and gives us an easy pathway to take into account the output count varint weight changes when including the drain output.
How this simplifies the API:
- The target & drain weights are included in the
CoinSelector, so they don't need to be passed in as method inputs. - Change policy can be simplified to just:
Fn(&CoinSelector) -> bool.
How we can take into account the output varint weight changes when including drain:
pub struct Target {
/*other fields*/
pub base_weight: u32,
pub drain_weights: DrainWeights,
}
impl Target {
pub fn new(
feerate: FeeRate,
recipient_outputs: impl IntoIterator<Item = (u32 /*weight*/, u64 /*value*/)>
drain_outputs: impl IntoIterator<Item = DrainWeights>,
) -> Self {
todo!()
}
}This calculates the base_weight and the drain_weight (which includes output varint changes) that are both included in Target.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request