Skip to content

Commit edb8633

Browse files
committed
f Introduce const for sync interval limit
1 parent 74cfe5d commit edb8633

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@ const RGS_SYNC_INTERVAL: Duration = Duration::from_secs(60 * 60);
199199
// The time in-between node announcement broadcast attempts.
200200
const NODE_ANN_BCAST_INTERVAL: Duration = Duration::from_secs(60 * 60);
201201

202+
// The lower limit which we apply to any configured wallet sync intervals.
203+
const WALLET_SYNC_INTERVAL_MINIMUM_SECS: u64 = 10;
204+
202205
// The length in bytes of our wallets' keys seed.
203206
const WALLET_KEYS_SEED_LEN: usize = 64;
204207

@@ -787,7 +790,7 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
787790
let sync_logger = Arc::clone(&self.logger);
788791
let mut stop_sync = self.stop_receiver.clone();
789792
let onchain_wallet_sync_interval_secs =
790-
self.config.onchain_wallet_sync_interval_secs.max(10);
793+
self.config.onchain_wallet_sync_interval_secs.max(WALLET_SYNC_INTERVAL_MINIMUM_SECS);
791794
std::thread::spawn(move || {
792795
tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(
793796
async move {
@@ -829,7 +832,8 @@ impl<K: KVStore + Sync + Send + 'static> Node<K> {
829832
let sync_cmon = Arc::clone(&self.chain_monitor);
830833
let sync_logger = Arc::clone(&self.logger);
831834
let mut stop_sync = self.stop_receiver.clone();
832-
let wallet_sync_interval_secs = self.config.wallet_sync_interval_secs.max(10);
835+
let wallet_sync_interval_secs =
836+
self.config.wallet_sync_interval_secs.max(WALLET_SYNC_INTERVAL_MINIMUM_SECS);
833837
runtime.spawn(async move {
834838
let mut wallet_sync_interval =
835839
tokio::time::interval(Duration::from_secs(wallet_sync_interval_secs));

0 commit comments

Comments
 (0)