From e9cde478ac3441ae76d19657ada31e3149aa6a2a Mon Sep 17 00:00:00 2001 From: jbesraa Date: Fri, 8 Nov 2024 09:36:03 +0200 Subject: [PATCH] f confirm/broadcast --- src/lib.rs | 63 ------------------------------------------------------ 1 file changed, 63 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8383ce993..1cba97941 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,4 @@ // This file is Copyright its original authors, visible in version control history. -// // This file is licensed under the Apache License, Version 2.0 or the MIT license , at your option. You may not use this file except in @@ -256,68 +255,6 @@ impl Node { .continuously_sync_wallets(stop_sync_receiver, sync_cman, sync_cmon, sync_sweeper) .await; }); - let sync_logger = Arc::clone(&self.logger); - let sync_payjoin = &self.payjoin_handler.as_ref(); - let sync_payjoin = sync_payjoin.map(Arc::clone); - let sync_wallet_timestamp = Arc::clone(&self.latest_wallet_sync_timestamp); - let sync_monitor_archival_height = Arc::clone(&self.latest_channel_monitor_archival_height); - let mut stop_sync = self.stop_sender.subscribe(); - let wallet_sync_interval_secs = - self.config.wallet_sync_interval_secs.max(WALLET_SYNC_INTERVAL_MINIMUM_SECS); - runtime.spawn(async move { - let mut wallet_sync_interval = - tokio::time::interval(Duration::from_secs(wallet_sync_interval_secs)); - wallet_sync_interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip); - loop { - tokio::select! { - _ = stop_sync.changed() => { - log_trace!( - sync_logger, - "Stopping background syncing Lightning wallet.", - ); - return; - } - _ = wallet_sync_interval.tick() => { - let mut confirmables = vec![ - &*sync_cman as &(dyn Confirm + Sync + Send), - &*sync_cmon as &(dyn Confirm + Sync + Send), - &*sync_sweeper as &(dyn Confirm + Sync + Send), - ]; - if let Some(sync_payjoin) = sync_payjoin.as_ref() { - confirmables.push(sync_payjoin.as_ref() as &(dyn Confirm + Sync + Send)); - } - let now = Instant::now(); - let timeout_fut = tokio::time::timeout(Duration::from_secs(LDK_WALLET_SYNC_TIMEOUT_SECS), tx_sync.sync(confirmables)); - match timeout_fut.await { - Ok(res) => match res { - Ok(()) => { - log_trace!( - sync_logger, - "Background sync of Lightning wallet finished in {}ms.", - now.elapsed().as_millis() - ); - let unix_time_secs_opt = - SystemTime::now().duration_since(UNIX_EPOCH).ok().map(|d| d.as_secs()); - *sync_wallet_timestamp.write().unwrap() = unix_time_secs_opt; - - periodically_archive_fully_resolved_monitors( - Arc::clone(&archive_cman), - Arc::clone(&archive_cmon), - Arc::clone(&sync_monitor_archival_height) - ); - } - Err(e) => { - log_error!(sync_logger, "Background sync of Lightning wallet failed: {}", e) - } - } - Err(e) => { - log_error!(sync_logger, "Background sync of Lightning wallet timed out: {}", e) - } - } - } - } - } - }); if self.gossip_source.is_rgs() { let gossip_source = Arc::clone(&self.gossip_source);