Fix typos
[rust-lightning] / src / util / transaction_utils.rs
1 use bitcoin::blockdata::transaction::TxOut;
2
3 use std::cmp::Ordering;
4
5 pub fn sort_outputs<T>(outputs: &mut Vec<(TxOut, T)>) { //TODO: Make static and put it in some utils somewhere (+inputs sorting)
6         outputs.sort_unstable_by(|a, b| {
7                 if a.0.value < b.0.value {
8                         Ordering::Less
9                 } else if b.0.value < a.0.value {
10                         Ordering::Greater
11                 } else if a.0.script_pubkey[..] < b.0.script_pubkey[..] { //TODO: ordering of scripts shouldn't be len-based
12                         Ordering::Less
13                 } else if b.0.script_pubkey[..] < a.0.script_pubkey[..] { //TODO: ordering of scripts shouldn't be len-based
14                         Ordering::Greater
15                 } else {
16                         Ordering::Equal
17                 }
18         });
19 }