#[derive(Debug, Clone)]
pub struct OutputGroup {
pub value: u64,
pub weight: u64,
pub input_count: usize,
pub creation_sequence: Option<u32>,
}
#[cfg(test)]
pub(crate) fn basic_output_group(value: u64, weight: u64) -> OutputGroup {
OutputGroup {
value,
weight,
input_count: 1,
creation_sequence: None,
}
}
#[derive(Debug, Clone)]
pub struct CoinSelectionOpt {
pub target_value: u64,
pub target_feerate: f32,
pub long_term_feerate: Option<f32>,
pub min_absolute_fee: u64,
pub base_weight: u64,
pub change_weight: u64,
pub change_cost: u64,
pub min_change_value: u64,
pub excess_strategy: ExcessStrategy,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ExcessStrategy {
ToFee,
ToRecipient,
ToChange,
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Clone, Copy)]
pub enum SelectionError {
InsufficientFunds {
available: u64,
required: u64,
},
NoSolutionFound,
NonPositiveTarget,
NonPositiveFeeRate,
AbnormallyHighFeeRate,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct WasteMetric(pub i64);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum SelectionAlgorithm {
BranchAndBound,
CoinGrinder,
Fifo,
LowestLarger,
}
#[derive(Debug)]
pub struct SelectionOutput {
pub selected_inputs: Vec<usize>,
pub waste: WasteMetric,
pub fee: u64,
}
pub type EffectiveValue = u64;
pub type Weight = u64;
pub const TOTAL_TRIES: u32 = 100_000;