[][src]Trait bdk::wallet::coin_selection::CoinSelectionAlgorithm

pub trait CoinSelectionAlgorithm: Debug {
    fn coin_select(
        &self,
        utxos: Vec<UTXO>,
        use_all_utxos: bool,
        fee_rate: FeeRate,
        amount_needed: u64,
        input_witness_weight: usize,
        fee_amount: f32
    ) -> Result<CoinSelectionResult, Error>; }

Trait for generalized coin selection algorithms

This trait can be implemented to make the Wallet use a customized coin selection algorithm when it creates transactions.

For an example see this module's documentation.

Required methods

fn coin_select(
    &self,
    utxos: Vec<UTXO>,
    use_all_utxos: bool,
    fee_rate: FeeRate,
    amount_needed: u64,
    input_witness_weight: usize,
    fee_amount: f32
) -> Result<CoinSelectionResult, Error>

Perform the coin selection

  • utxos: the list of spendable UTXOs
  • use_all_utxos: if true all utxos should be spent unconditionally
  • fee_rate: fee rate to use
  • amount_needed: the amount in satoshi to select
  • input_witness_weight: the weight of an input's witness to keep into account for the fees
  • fee_amount: the amount of fees in satoshi already accumulated from adding outputs
Loading content...

Implementors

impl CoinSelectionAlgorithm for DumbCoinSelection[src]

Loading content...