1 use bitcoin::blockdata::transaction::TxOut;
3 use std::cmp::Ordering;
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 {
9 } else if b.0.value < a.0.value {
11 } else if a.0.script_pubkey[..] < b.0.script_pubkey[..] { //TODO: ordering of scripts shouldn't be len-based
13 } else if b.0.script_pubkey[..] < a.0.script_pubkey[..] { //TODO: ordering of scripts shouldn't be len-based