Skip to content

Commit ddbcf5c

Browse files
committed
Use updated sync terminology.
1 parent 345d63e commit ddbcf5c

File tree

1 file changed

+16
-16
lines changed
  • lightning-background-processor/src

1 file changed

+16
-16
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ use std::ops::Deref;
5757
pub struct BackgroundProcessor {
5858
stop_thread: Arc<AtomicBool>,
5959
thread_handle: Option<JoinHandle<Result<(), std::io::Error>>>,
60-
is_awaiting_graph_sync_completion: Arc<AtomicBool>
60+
is_awaiting_rapid_sync_completion: Arc<AtomicBool>
6161
}
6262

6363
#[cfg(not(test))]
@@ -153,11 +153,11 @@ impl BackgroundProcessor {
153153
/// [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
154154
/// [`NetworkGraph::write`]: lightning::routing::network_graph::NetworkGraph#impl-Writeable
155155
///
156-
/// # Graph Sync
156+
/// # Rapid Gossip Sync
157157
///
158-
/// If a rapid graph sync is meant to run at startup, set `await_graph_sync_completion` to true
159-
/// to indicate to [`BackgroundProcessor`] not to prune the [`NetworkGraph`] instance until
160-
/// [`graph_sync_complete`] is called.
158+
/// If a rapid gossip sync is meant to run at startup, set `await_rapid_gossip_sync_completion`
159+
/// to true to indicate to [`BackgroundProcessor`] not to prune the [`NetworkGraph`] instance
160+
/// until [`rapid_gossip_sync_complete`] is called.
161161
pub fn start<
162162
'a,
163163
Signer: 'static + Sign,
@@ -184,7 +184,7 @@ impl BackgroundProcessor {
184184
SC: WriteableScore<'a>,
185185
>(
186186
persister: PS, event_handler: EH, chain_monitor: M, channel_manager: CM,
187-
net_graph_msg_handler: Option<NG>, peer_manager: PM, await_graph_sync_completion: bool, logger: L, scorer: Option<S>
187+
net_graph_msg_handler: Option<NG>, peer_manager: PM, await_rapid_gossip_sync_completion: bool, logger: L, scorer: Option<S>
188188
) -> Self
189189
where
190190
CA::Target: 'static + chain::Access,
@@ -202,7 +202,7 @@ impl BackgroundProcessor {
202202
{
203203
let stop_thread = Arc::new(AtomicBool::new(false));
204204
let stop_thread_clone = stop_thread.clone();
205-
let is_awaiting_graph_sync_completion = Arc::new(AtomicBool::new(await_graph_sync_completion));
205+
let is_awaiting_graph_sync_completion = Arc::new(AtomicBool::new(await_rapid_gossip_sync_completion));
206206
let is_awaiting_graph_sync_completion_clone = is_awaiting_graph_sync_completion.clone();
207207
let handle = thread::spawn(move || -> Result<(), std::io::Error> {
208208
let event_handler = DecoratingEventHandler { event_handler, net_graph_msg_handler: net_graph_msg_handler.as_ref().map(|t| t.deref()) };
@@ -283,10 +283,10 @@ impl BackgroundProcessor {
283283
if last_prune_call.elapsed().as_secs() > if have_pruned { NETWORK_PRUNE_TIMER } else { FIRST_NETWORK_PRUNE_TIMER } {
284284
if let Some(ref handler) = net_graph_msg_handler {
285285
log_trace!(logger, "Assessing prunability of network graph");
286-
// The network graph must not be pruned while graph sync completion is pending
286+
// The network graph must not be pruned while rapid sync completion is pending
287287
let is_currently_awaiting_graph_sync = is_awaiting_graph_sync_completion_clone.load(Ordering::Acquire);
288288
if is_currently_awaiting_graph_sync {
289-
log_trace!(logger, "Not pruning network graph due to pending graph sync");
289+
log_trace!(logger, "Not pruning network graph due to pending gossip sync");
290290
continue;
291291
}
292292
log_trace!(logger, "Pruning network graph of stale entries");
@@ -324,7 +324,7 @@ impl BackgroundProcessor {
324324

325325
Ok(())
326326
});
327-
Self { stop_thread: stop_thread_clone, thread_handle: Some(handle), is_awaiting_graph_sync_completion }
327+
Self { stop_thread: stop_thread_clone, thread_handle: Some(handle), is_awaiting_rapid_sync_completion: is_awaiting_graph_sync_completion }
328328
}
329329

330330
/// Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
@@ -355,12 +355,12 @@ impl BackgroundProcessor {
355355
self.stop_and_join_thread()
356356
}
357357

358-
/// Signal to [`BackgroundProcessor`] that the initial rapid graph sync has completed.
358+
/// Signal to [`BackgroundProcessor`] that the initial rapid gossip sync has completed.
359359
///
360360
/// This function can only be called usefully once, so there is an implicit understanding
361-
/// that running graph sync multiple times after startup is API misuse.
362-
pub fn graph_sync_complete(&self) {
363-
self.is_awaiting_graph_sync_completion.store(false, Ordering::Release)
361+
/// that running rapid sync multiple times after startup is API misuse.
362+
pub fn rapid_gossip_sync_complete(&self) {
363+
self.is_awaiting_rapid_sync_completion.store(false, Ordering::Release)
364364
}
365365

366366
fn stop_and_join_thread(&mut self) -> Result<(), std::io::Error> {
@@ -844,14 +844,14 @@ mod tests {
844844
loop {
845845
let log_entries = nodes[0].logger.lines.lock().unwrap();
846846
let expected_log_a = "Assessing prunability of network graph".to_string();
847-
let expected_log_b = "Not pruning network graph due to pending graph sync".to_string();
847+
let expected_log_b = "Not pruning network graph due to pending gossip sync".to_string();
848848
if log_entries.get(&("lightning_background_processor".to_string(), expected_log_a)).is_some() &&
849849
log_entries.get(&("lightning_background_processor".to_string(), expected_log_b)).is_some() {
850850
break
851851
}
852852
}
853853

854-
bg_processor.graph_sync_complete();
854+
bg_processor.rapid_gossip_sync_complete();
855855

856856
let _ = receiver
857857
.recv_timeout(Duration::from_secs(super::FIRST_NETWORK_PRUNE_TIMER * 2))

0 commit comments

Comments
 (0)