Trait bdk::wallet::coin_selection::CoinSelectionAlgorithm [−][src]
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,
database: &D,
required_utxos: Vec<WeightedUtxo>,
optional_utxos: Vec<WeightedUtxo>,
fee_rate: FeeRate,
amount_needed: u64,
fee_amount: f32
) -> Result<CoinSelectionResult, Error>
[src]
&self,
database: &D,
required_utxos: Vec<WeightedUtxo>,
optional_utxos: Vec<WeightedUtxo>,
fee_rate: FeeRate,
amount_needed: u64,
fee_amount: f32
) -> Result<CoinSelectionResult, Error>
Perform the coin selection
database
: a reference to the wallet’s database that can be used to lookup additional details for a specific UTXOrequired_utxos
: the utxos that must be spent regardless ofamount_needed
with their weight costoptional_utxos
: the remaining available utxos to satisfyamount_needed
with their weight costfee_rate
: fee rate to useamount_needed
: the amount in satoshi to selectfee_amount
: the amount of fees in satoshi already accumulated from adding outputs and the transaction’s header
Implementors
impl<D: Database> CoinSelectionAlgorithm<D> for BranchAndBoundCoinSelection
[src]
fn coin_select(
&self,
_database: &D,
required_utxos: Vec<WeightedUtxo>,
optional_utxos: Vec<WeightedUtxo>,
fee_rate: FeeRate,
amount_needed: u64,
fee_amount: f32
) -> Result<CoinSelectionResult, Error>
[src]
&self,
_database: &D,
required_utxos: Vec<WeightedUtxo>,
optional_utxos: Vec<WeightedUtxo>,
fee_rate: FeeRate,
amount_needed: u64,
fee_amount: f32
) -> Result<CoinSelectionResult, Error>
impl<D: Database> CoinSelectionAlgorithm<D> for LargestFirstCoinSelection
[src]
fn coin_select(
&self,
_database: &D,
required_utxos: Vec<WeightedUtxo>,
optional_utxos: Vec<WeightedUtxo>,
fee_rate: FeeRate,
amount_needed: u64,
fee_amount: f32
) -> Result<CoinSelectionResult, Error>
[src]
&self,
_database: &D,
required_utxos: Vec<WeightedUtxo>,
optional_utxos: Vec<WeightedUtxo>,
fee_rate: FeeRate,
amount_needed: u64,
fee_amount: f32
) -> Result<CoinSelectionResult, Error>