@@ -172,7 +172,7 @@ pub fn branch_and_bound<'a, T: IntoIterator<Item = &'a WeightedUtxo> + std::mark
172172
173173 // descending sort by effective_value, ascending sort by waste.
174174 weighted_utxos
175- . sort_by ( |a, b| b. effective_value ( ) . cmp ( & a. effective_value ( ) ) . then ( a. waste . cmp ( & b. waste ) ) ) ;
175+ . sort_by ( |a, b| b. effective_value ( ) . cmp ( & a. effective_value ( ) ) . then ( a. waste ( ) . cmp ( & b. waste ( ) ) ) ) ;
176176
177177 if available_value < target {
178178 return Err ( InsufficentFunds ) ;
@@ -247,13 +247,13 @@ pub fn branch_and_bound<'a, T: IntoIterator<Item = &'a WeightedUtxo> + std::mark
247247 break ;
248248 }
249249
250- let eff_value = weighted_utxos[ index] . effective_value ;
250+ let eff_value = weighted_utxos[ index] . effective_value_raw ( ) ;
251251 available_value += eff_value;
252252 }
253253
254254 assert_eq ! ( index, * index_selection. last( ) . unwrap( ) ) ;
255- let eff_value = weighted_utxos[ index] . effective_value ;
256- let utxo_waste = weighted_utxos[ index] . waste ;
255+ let eff_value = weighted_utxos[ index] . effective_value_raw ( ) ;
256+ let utxo_waste = weighted_utxos[ index] . waste_raw ( ) ;
257257 let utxo_weight = weighted_utxos[ index] . weight ( ) ;
258258 current_waste = current_waste. checked_sub ( utxo_waste) . ok_or ( Overflow ( Subtraction ) ) ?;
259259 value = value. checked_sub ( eff_value) . ok_or ( Overflow ( Addition ) ) ?;
@@ -262,9 +262,9 @@ pub fn branch_and_bound<'a, T: IntoIterator<Item = &'a WeightedUtxo> + std::mark
262262 }
263263 // * Add next node to the inclusion branch.
264264 else {
265- let eff_value = weighted_utxos[ index] . effective_value ;
265+ let eff_value = weighted_utxos[ index] . effective_value_raw ( ) ;
266266 let utxo_weight = weighted_utxos[ index] . weight ( ) ;
267- let utxo_waste = weighted_utxos[ index] . waste ;
267+ let utxo_waste = weighted_utxos[ index] . waste_raw ( ) ;
268268
269269 // unchecked sub is used her for performance.
270270 // The bounds for available_value are at most the sum of utxos
@@ -277,7 +277,7 @@ pub fn branch_and_bound<'a, T: IntoIterator<Item = &'a WeightedUtxo> + std::mark
277277 // Check if the previous UTXO was included.
278278 || index - 1 == * index_selection. last ( ) . unwrap ( )
279279 // Check if the previous UTXO has the same value has the previous one.
280- || weighted_utxos[ index] . effective_value != weighted_utxos[ index - 1 ] . effective_value
280+ || weighted_utxos[ index] . effective_value_raw ( ) != weighted_utxos[ index - 1 ] . effective_value_raw ( )
281281 {
282282 index_selection. push ( index) ;
283283 current_waste = current_waste. checked_add ( utxo_waste) . ok_or ( Overflow ( Addition ) ) ?;
0 commit comments