Skip to content

Commit

Permalink
Feature-gate time use also in ElectrumSyncClient
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tnull committed Jan 9, 2024
1 parent 78ac48c commit 2bd1213
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lightning-transaction-sync/src/electrum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ where
let mut sync_state = self.sync_state.lock().unwrap();

log_trace!(self.logger, "Starting transaction sync.");
#[cfg(feature = "time")]
let start_time = Instant::now();
let mut num_confirmed = 0;
let mut num_unconfirmed = 0;
Expand Down Expand Up @@ -210,10 +211,15 @@ where
sync_state.pending_sync = false;
}
}
#[cfg(feature = "time")]
log_debug!(self.logger,
"Finished transaction sync at tip {} in {}ms: {} confirmed, {} unconfirmed.",
tip_header.block_hash(), start_time.elapsed().as_millis(), num_confirmed,
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(())
}

Expand Down

0 comments on commit 2bd1213

Please sign in to comment.