Skip to content

Commit e9cde47

Browse files
committed
f confirm/broadcast
1 parent 784a0b7 commit e9cde47

File tree

1 file changed

+0
-63
lines changed

1 file changed

+0
-63
lines changed

src/lib.rs

-63
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// This file is Copyright its original authors, visible in version control history.
2-
//
32
// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
43
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
54
// http://opensource.org/licenses/MIT>, at your option. You may not use this file except in
@@ -256,68 +255,6 @@ impl Node {
256255
.continuously_sync_wallets(stop_sync_receiver, sync_cman, sync_cmon, sync_sweeper)
257256
.await;
258257
});
259-
let sync_logger = Arc::clone(&self.logger);
260-
let sync_payjoin = &self.payjoin_handler.as_ref();
261-
let sync_payjoin = sync_payjoin.map(Arc::clone);
262-
let sync_wallet_timestamp = Arc::clone(&self.latest_wallet_sync_timestamp);
263-
let sync_monitor_archival_height = Arc::clone(&self.latest_channel_monitor_archival_height);
264-
let mut stop_sync = self.stop_sender.subscribe();
265-
let wallet_sync_interval_secs =
266-
self.config.wallet_sync_interval_secs.max(WALLET_SYNC_INTERVAL_MINIMUM_SECS);
267-
runtime.spawn(async move {
268-
let mut wallet_sync_interval =
269-
tokio::time::interval(Duration::from_secs(wallet_sync_interval_secs));
270-
wallet_sync_interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);
271-
loop {
272-
tokio::select! {
273-
_ = stop_sync.changed() => {
274-
log_trace!(
275-
sync_logger,
276-
"Stopping background syncing Lightning wallet.",
277-
);
278-
return;
279-
}
280-
_ = wallet_sync_interval.tick() => {
281-
let mut confirmables = vec![
282-
&*sync_cman as &(dyn Confirm + Sync + Send),
283-
&*sync_cmon as &(dyn Confirm + Sync + Send),
284-
&*sync_sweeper as &(dyn Confirm + Sync + Send),
285-
];
286-
if let Some(sync_payjoin) = sync_payjoin.as_ref() {
287-
confirmables.push(sync_payjoin.as_ref() as &(dyn Confirm + Sync + Send));
288-
}
289-
let now = Instant::now();
290-
let timeout_fut = tokio::time::timeout(Duration::from_secs(LDK_WALLET_SYNC_TIMEOUT_SECS), tx_sync.sync(confirmables));
291-
match timeout_fut.await {
292-
Ok(res) => match res {
293-
Ok(()) => {
294-
log_trace!(
295-
sync_logger,
296-
"Background sync of Lightning wallet finished in {}ms.",
297-
now.elapsed().as_millis()
298-
);
299-
let unix_time_secs_opt =
300-
SystemTime::now().duration_since(UNIX_EPOCH).ok().map(|d| d.as_secs());
301-
*sync_wallet_timestamp.write().unwrap() = unix_time_secs_opt;
302-
303-
periodically_archive_fully_resolved_monitors(
304-
Arc::clone(&archive_cman),
305-
Arc::clone(&archive_cmon),
306-
Arc::clone(&sync_monitor_archival_height)
307-
);
308-
}
309-
Err(e) => {
310-
log_error!(sync_logger, "Background sync of Lightning wallet failed: {}", e)
311-
}
312-
}
313-
Err(e) => {
314-
log_error!(sync_logger, "Background sync of Lightning wallet timed out: {}", e)
315-
}
316-
}
317-
}
318-
}
319-
}
320-
});
321258

322259
if self.gossip_source.is_rgs() {
323260
let gossip_source = Arc::clone(&self.gossip_source);

0 commit comments

Comments
 (0)