Skip to content

Commit

Permalink
Don't call system time in no-std
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Dec 17, 2023
1 parent 4deb263 commit 64c98c4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lightning-transaction-sync/src/esplora.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use esplora_client::r#async::AsyncClient;
#[cfg(not(feature = "async-interface"))]
use esplora_client::blocking::BlockingClient;

use std::time::Instant;
use std::collections::HashSet;
use core::ops::Deref;

Expand Down Expand Up @@ -91,7 +90,8 @@ where
let mut sync_state = self.sync_state.lock().await;

log_trace!(self.logger, "Starting transaction sync.");
let start_time = Instant::now();
#[cfg(feature = "std")]
let start_time = std::time::Instant::now();
let mut num_confirmed = 0;
let mut num_unconfirmed = 0;

Expand Down Expand Up @@ -227,8 +227,12 @@ where
sync_state.pending_sync = false;
}
}
#[cfg(feature = "std")]
log_debug!(self.logger, "Finished transaction sync at tip {} in {}ms: {} confirmed, {} unconfirmed.",
tip_hash, start_time.elapsed().as_millis(), num_confirmed, num_unconfirmed);
#[cfg(not(feature = "std"))]
log_debug!(self.logger, "Finished transaction sync at tip {}: {} confirmed, {} unconfirmed.",
tip_hash, num_confirmed, num_unconfirmed);
Ok(())
}

Expand Down

0 comments on commit 64c98c4

Please sign in to comment.