Consolidate fee_amount and amount_needed

Before this commit `fee_amount` and `amount_needed` were passed as independent
parameters. From the perspective of coin selection algorithms, they are always
used jointly for the same purpose, to create a coin selection with a total
effective value greater than it's summed values.

This commit removes the abstraction that the use of the two parameter
introduced by consolidating both into a single parameter, `target_amount`, who
carries their values added up.
This commit is contained in:
Cesar Alvarez Vallero
2022-07-10 19:57:44 -03:00
committed by Daniela Brozzoni
parent 1730e0150f
commit e8df3d2d91
3 changed files with 104 additions and 129 deletions

View File

@@ -802,11 +802,10 @@ where
required_utxos,
optional_utxos,
fee_rate,
outgoing,
fee_amount,
outgoing + fee_amount,
&drain_script,
)?;
let mut fee_amount = coin_selection.fee_amount;
fee_amount += coin_selection.fee_amount;
let excess = &coin_selection.excess;
tx.input = coin_selection