)? {
        output.push(OutputTsv {
          sat: sat.into(),
          output: outpoint,
        });
      }
      Ok(Box::new(output))
    } else {
      let mut output = Vec::new();
      for (outpoint, sat, offset, rarity) in rare_sats(utxos) {
        output.push(OutputRare {
          sat,
          output: outpoint,
          offset,
          rarity,
        });
      }
      Ok(Box::new(output))
    }
  }
}

fn rare_sats(utxos: Vec<(OutPoint, Vec<(u64, u64)>)>) -> Vec<(OutPoint, Sat, u64, Rarity)> {
  utxos
    .into_iter()
    .flat_map(|(outpoint, sat_ranges)| {
      let mut offset = 0;
      sat_ranges.into_iter().filter_map(move |(start, end)| {
        let sat = Sat(start);
        let rarity = sat.rarity();
        let start_offset = offset;
        offset += end - start;
        if rarity > Rarity::Common {
          Some((outpoint, sat, start_offset, rarity))
        } else {
          None
        }
      })
    })
    .collect()
}

fn sats_from_tsv(
  utxos: Vec<(OutPoint, Vec<(u64, u64)>)>,