use std::{ cmp::Ordering, collections::HashSet, hash::{Hash, Hasher}, }; #[derive(Clone)] pub struct AuditTransaction { pub uid: u32, pub fee: u64, pub weight: u32, pub sigops: u32, pub fee_per_vsize: f64, pub effective_fee_per_vsize: f64, pub dependency_rate: f64, pub inputs: Vec, pub relatives_set_flag: bool, pub ancestors: HashSet, pub children: HashSet, pub ancestor_fee: u64, pub ancestor_weight: u32, pub ancestor_sigops: u32, pub score: f64, pub used: bool, pub modified: bool, pub dirty: bool, } impl Hash for AuditTransaction { fn hash(&self, state: &mut H) { self.uid.hash(state); } } impl PartialEq for AuditTransaction { fn eq(&self, other: &Self) -> bool { self.uid == other.uid } } impl Eq for AuditTransaction {} impl PartialOrd for AuditTransaction { fn partial_cmp(&self, other: &AuditTransaction) -> Option { if self.score == other.score { Some(self.uid.cmp(&other.uid)) } else { self.score.partial_cmp(&other.score) } } } impl Ord for AuditTransaction { fn cmp(&self, other: &AuditTransaction) -> Ordering { self.partial_cmp(other).unwrap() } }