diff --git a/crates/lox-distributor/src/lox_context.rs b/crates/lox-distributor/src/lox_context.rs index d7bdb136ea1d1f3d32087af19d537a9b18b82b5b..0f256d01682d849f86f7942e10596d368baf943a 100644 --- a/crates/lox-distributor/src/lox_context.rs +++ b/crates/lox-distributor/src/lox_context.rs @@ -415,6 +415,9 @@ impl LoxServerContext { let mut ba_obj = self.ba.lock().unwrap(); ba_obj.advance_days(num); // FOR TESTING ONLY println!("Today's date according to server: {}", ba_obj.today()); + // Also advance days for BridgeDb + let mut db_obj = self.db.lock().unwrap(); + db_obj.advance_days(num); // FOR TESTING ONLY } // Encrypts the Lox bridge table, should be called after every sync diff --git a/crates/lox-library/src/lib.rs b/crates/lox-library/src/lib.rs index 3ade055a7d8a83b86c6b0562eb004790d1cb6eff..8ed51bf9a56c0ae475b9e138e1e0c0a0675429ef 100644 --- a/crates/lox-library/src/lib.rs +++ b/crates/lox-library/src/lib.rs @@ -287,6 +287,17 @@ impl BridgeDb { Err(SignatureError::new()) } } + + ///#[cfg(test)] + /// For testing only: manually advance the day by the given number + /// of days + pub fn advance_days(&mut self, days: u16) { + if days > 0 { + self.today += Duration::days(days.into()); + // Reset daily bridges distributed count + self.daily_bridges_distributed = 0; + } + } } impl Default for BridgeDb {