@@ -147,20 +147,20 @@ impl CoinSelectionResult {
147
147
148
148
/// Metric introduced to measure the performance of different coin selection algorithms.
149
149
///
150
- /// This implementations considers waste as the sum of two values:
150
+ /// This implementation considers " waste" the sum of two values:
151
151
/// * Timing cost
152
152
/// * Creation cost
153
153
/// > waste = timing_cost + creation_cost
154
154
///
155
- /// **Timing cost** is the cost associated to the current fee rate and some long term fee rate used
156
- /// as a treshold to consolidate UTXOs.
155
+ /// **Timing cost** is the cost associated with the current fee rate and some long term fee rate used
156
+ /// as a threshold to consolidate UTXOs.
157
157
/// > timing_cost = txin_size * current_fee_rate - txin_size * long_term_fee_rate
158
158
///
159
159
/// Timing cost can be negative if the `current_fee_rate` is cheaper than the `long_term_fee_rate`,
160
160
/// or zero if they are equal.
161
161
///
162
- /// **Creation cost** is the cost associated to the surplus of coins besides the transaction amount
163
- /// and transaction fees. It can happen in the form of a change output or in the form of excess
162
+ /// **Creation cost** is the cost associated with the surplus of coins beyond the transaction amount
163
+ /// and transaction fees. It can appear in the form of a change output or in the form of excess
164
164
/// fees paid to the miner.
165
165
///
166
166
/// Change cost is derived from the cost of adding the extra output to the transaction and spending
@@ -177,7 +177,7 @@ impl CoinSelectionResult {
177
177
/// algorithm.
178
178
///
179
179
/// So, waste can be zero if creation and timing cost are zero. Or can be negative, if timing cost
180
- /// is negative and the creation cost is lower enough (less than the absolute value of timing
180
+ /// is negative and the creation cost is low enough (less than the absolute value of timing
181
181
/// cost).
182
182
#[ derive( Debug , PartialEq , Eq , PartialOrd , Ord ) ]
183
183
pub struct Waste ( pub i64 ) ;
@@ -189,7 +189,10 @@ impl Waste {
189
189
///
190
190
/// - `selected`: the selected transaction inputs
191
191
/// - `cost_of_change`: the cost of creating change and spending it in the future
192
- /// - `target`: the amount in satoshis of the aimed transaction output
192
+ /// - `target`: threshold in satoshis used to select UTXOs. It includes the sum of recipient
193
+ /// outputs, the fees for creating the recipient outputs and the fees for fixed transaction
194
+ /// parts
195
+
193
196
/// - `fee_rate`: fee rate to use
194
197
pub fn calculate (
195
198
selected : & [ WeightedUtxo ] ,
@@ -1511,7 +1514,7 @@ mod test {
1511
1514
let change_out_size = 31_f32 ;
1512
1515
let change_in_size = 68_f32 ;
1513
1516
let cost_of_change: u64 = ( change_out_size * fee_rate. as_sat_vb ( )
1514
- - change_in_size * LONG_TERM_FEE_RATE . as_sat_vb ( ) )
1517
+ + change_in_size * LONG_TERM_FEE_RATE . as_sat_vb ( ) )
1515
1518
as u64 ;
1516
1519
1517
1520
let utxo_fee_diff: i64 = utxos. iter ( ) . fold ( 0 , |acc, utxo| {
0 commit comments