pub struct NonDustDrainCoinSelection;Expand description
Coin selection for transactions whose only output is the drain (change) output, like a CPFP child. Guarantees that this output ends up above the dust limit.
BDK’s default algorithm stops selecting coins as soon as the target amount is covered. If the
selected coins overshoot the target by less than the dust limit, the leftover is too small to
be a valid output. Normally BDK would drop it and let it go to fees, but when the drain is the
transaction’s only output, dropping it leaves no outputs at all, so TxBuilder::finish fails
with InsufficientFunds — even if the wallet has plenty of other coins available.
This wrapper asks the default algorithm for slightly more: the dust limit, plus the fee the drain output itself adds. That makes it keep pulling in coins until the leftover is a valid output. The result is then adjusted so that the extra ends up in the drain output rather than being burned as fee.
Trait Implementations§
Source§impl Clone for NonDustDrainCoinSelection
impl Clone for NonDustDrainCoinSelection
Source§fn clone(&self) -> NonDustDrainCoinSelection
fn clone(&self) -> NonDustDrainCoinSelection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more