fn select_cardinal_utxo( &mut self, target_value: Amount, prefer_under: bool, ) -> Result<(OutPoint, Amount)> { tprintln!( "looking for {} cardinal worth {target_value}", if prefer_under { "smaller" } else { "bigger" } ); let inscribed_utxos = self .inscriptions .keys() .map(|satpoint| satpoint.outpoint) .collect::>(); let mut best_match = None; for utxo in &self.utxos { if inscribed_utxos.contains(utxo) || self.locked_utxos.contains(utxo) { continue; } let current_value = self.amounts[utxo]; let (_, best_value) = match best_match { Some(prev) => prev, None => { best_match = Some((*utxo, current_value)); (*utxo, current_value) } }; let abs_diff = |a: Amount, b: Amount| -> Amount { max(a, b) - min(a, b) }; let is_closer = abs_diff(current_value, target_value) < abs_diff(best_value, target_value); let not_preference_but_closer = if prefer_under {