Feature-gate time use also in ElectrumSyncClient

A previous commit introduced the `time` feature to gate the use of
`SystemTime` dependent APIs in `EsploraSyncClient`. It however omitted
doing the same for the Electrum side of things. Here, we address this
oversight.
This commit is contained in:
Elias Rohrer 2024-01-09 09:37:14 +01:00
parent 78ac48ca9e
commit 2bd12137a4
No known key found for this signature in database
GPG key ID: 36153082BDF676FD

View file

@ -86,6 +86,7 @@ where
let mut sync_state = self.sync_state.lock().unwrap(); let mut sync_state = self.sync_state.lock().unwrap();
log_trace!(self.logger, "Starting transaction sync."); log_trace!(self.logger, "Starting transaction sync.");
#[cfg(feature = "time")]
let start_time = Instant::now(); let start_time = Instant::now();
let mut num_confirmed = 0; let mut num_confirmed = 0;
let mut num_unconfirmed = 0; let mut num_unconfirmed = 0;
@ -210,10 +211,15 @@ where
sync_state.pending_sync = false; sync_state.pending_sync = false;
} }
} }
#[cfg(feature = "time")]
log_debug!(self.logger, log_debug!(self.logger,
"Finished transaction sync at tip {} in {}ms: {} confirmed, {} unconfirmed.", "Finished transaction sync at tip {} in {}ms: {} confirmed, {} unconfirmed.",
tip_header.block_hash(), start_time.elapsed().as_millis(), num_confirmed, tip_header.block_hash(), start_time.elapsed().as_millis(), num_confirmed,
num_unconfirmed); num_unconfirmed);
#[cfg(not(feature = "time"))]
log_debug!(self.logger,
"Finished transaction sync at tip {}: {} confirmed, {} unconfirmed.",
tip_header.block_hash(), num_confirmed, num_unconfirmed);
Ok(()) Ok(())
} }