@@ -57,7 +57,7 @@ use std::ops::Deref;
57
57
pub struct BackgroundProcessor {
58
58
stop_thread : Arc < AtomicBool > ,
59
59
thread_handle : Option < JoinHandle < Result < ( ) , std:: io:: Error > > > ,
60
- is_awaiting_graph_sync_completion : Arc < AtomicBool >
60
+ is_awaiting_rapid_sync_completion : Arc < AtomicBool >
61
61
}
62
62
63
63
#[ cfg( not( test) ) ]
@@ -153,11 +153,11 @@ impl BackgroundProcessor {
153
153
/// [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
154
154
/// [`NetworkGraph::write`]: lightning::routing::network_graph::NetworkGraph#impl-Writeable
155
155
///
156
- /// # Graph Sync
156
+ /// # Rapid Gossip Sync
157
157
///
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.
161
161
pub fn start <
162
162
' a ,
163
163
Signer : ' static + Sign ,
@@ -184,7 +184,7 @@ impl BackgroundProcessor {
184
184
SC : WriteableScore < ' a > ,
185
185
> (
186
186
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 >
188
188
) -> Self
189
189
where
190
190
CA :: Target : ' static + chain:: Access ,
@@ -202,7 +202,7 @@ impl BackgroundProcessor {
202
202
{
203
203
let stop_thread = Arc :: new ( AtomicBool :: new ( false ) ) ;
204
204
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 ) ) ;
206
206
let is_awaiting_graph_sync_completion_clone = is_awaiting_graph_sync_completion. clone ( ) ;
207
207
let handle = thread:: spawn ( move || -> Result < ( ) , std:: io:: Error > {
208
208
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 {
283
283
if last_prune_call. elapsed ( ) . as_secs ( ) > if have_pruned { NETWORK_PRUNE_TIMER } else { FIRST_NETWORK_PRUNE_TIMER } {
284
284
if let Some ( ref handler) = net_graph_msg_handler {
285
285
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
287
287
let is_currently_awaiting_graph_sync = is_awaiting_graph_sync_completion_clone. load ( Ordering :: Acquire ) ;
288
288
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" ) ;
290
290
continue ;
291
291
}
292
292
log_trace ! ( logger, "Pruning network graph of stale entries" ) ;
@@ -324,7 +324,7 @@ impl BackgroundProcessor {
324
324
325
325
Ok ( ( ) )
326
326
} ) ;
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 }
328
328
}
329
329
330
330
/// Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting
@@ -355,12 +355,12 @@ impl BackgroundProcessor {
355
355
self . stop_and_join_thread ( )
356
356
}
357
357
358
- /// Signal to [`BackgroundProcessor`] that the initial rapid graph sync has completed.
358
+ /// Signal to [`BackgroundProcessor`] that the initial rapid gossip sync has completed.
359
359
///
360
360
/// 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 )
364
364
}
365
365
366
366
fn stop_and_join_thread ( & mut self ) -> Result < ( ) , std:: io:: Error > {
@@ -844,14 +844,14 @@ mod tests {
844
844
loop {
845
845
let log_entries = nodes[ 0 ] . logger . lines . lock ( ) . unwrap ( ) ;
846
846
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 ( ) ;
848
848
if log_entries. get ( & ( "lightning_background_processor" . to_string ( ) , expected_log_a) ) . is_some ( ) &&
849
849
log_entries. get ( & ( "lightning_background_processor" . to_string ( ) , expected_log_b) ) . is_some ( ) {
850
850
break
851
851
}
852
852
}
853
853
854
- bg_processor. graph_sync_complete ( ) ;
854
+ bg_processor. rapid_gossip_sync_complete ( ) ;
855
855
856
856
let _ = receiver
857
857
. recv_timeout ( Duration :: from_secs ( super :: FIRST_NETWORK_PRUNE_TIMER * 2 ) )
0 commit comments