From d1403c97641a6cb59dd7c9ba1462982a337597ea Mon Sep 17 00:00:00 2001 From: Stephen Akridge Date: Thu, 10 May 2018 13:02:44 -0700 Subject: [PATCH] Debug stuff --- src/accountant.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/accountant.rs b/src/accountant.rs index d97e2067350b30..5692ec40244491 100644 --- a/src/accountant.rs +++ b/src/accountant.rs @@ -47,6 +47,7 @@ pub struct Accountant { last_ids: RwLock>)>>, time_sources: RwLock>, last_time: RwLock>, + counter: RwLock, } impl Accountant { @@ -60,6 +61,7 @@ impl Accountant { last_ids: RwLock::new(VecDeque::new()), time_sources: RwLock::new(HashSet::new()), last_time: RwLock::new(Utc.timestamp(0, 0)), + counter: RwLock::new(0), } } @@ -83,6 +85,7 @@ impl Accountant { fn reserve_signature(signatures: &RwLock>, sig: &Signature) -> bool { if signatures.read().unwrap().contains(sig) { + trace!("signatures already contains signature"); return false; } signatures.write().unwrap().insert(*sig); @@ -116,6 +119,9 @@ impl Accountant { { return Self::reserve_signature(&entry.1, sig); } + trace!("reserve_signature didn't find id"); + trace!("id: {:?}", last_id); + trace!("{:?}", self.last_ids); false } @@ -173,6 +179,7 @@ impl Accountant { plan.apply_witness(&Witness::Timestamp(*self.last_time.read().unwrap())); if let Some(ref payment) = plan.final_payment() { + *self.counter.write().unwrap() += 1; apply_payment(&self.balances, payment); } else { let mut pending = self.pending.write().unwrap(); @@ -220,6 +227,7 @@ impl Accountant { pub fn process_verified_events(&self, events: Vec) -> Vec> { let (trs, rest) = Self::partition_events(events); + trace!("trs: {} rest: {}", trs.len(), rest.len()); let mut results: Vec<_> = self.process_verified_transactions(trs) .into_iter() .map(|x| x.map(Event::Transaction)) @@ -228,6 +236,7 @@ impl Accountant { for event in rest { results.push(self.process_verified_event(event)); } + trace!("results: {} counter: {}", results.len(), self.counter.read().unwrap()); results }