From dd610d0879fbae1af92cf3fe29d57b0b9f5a1518 Mon Sep 17 00:00:00 2001 From: woodser Date: Mon, 21 Dec 2020 15:05:20 -0500 Subject: [PATCH] sync period defined as long in milliseconds --- src/wallet/monero_wallet.h | 6 +++--- src/wallet/monero_wallet_core.cpp | 12 +++--------- src/wallet/monero_wallet_core.h | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/wallet/monero_wallet.h b/src/wallet/monero_wallet.h index d25f1a5..7301f11 100644 --- a/src/wallet/monero_wallet.h +++ b/src/wallet/monero_wallet.h @@ -460,11 +460,11 @@ namespace monero { } /** - * Start background synchronizing with a maximum number of seconds between syncs. + * Start background synchronizing with a maximum period between syncs. * - * @param sync_rate_in_seconds - maximum number of seconds between wallet syncs for updates (default 10 seconds) + * @param syncPeriodInMs - maximum period between syncs in milliseconds */ - virtual void start_syncing(uint32_t sync_rate_in_seconds = 10) { + virtual void start_syncing(uint64_t sync_period_in_ms = 10000) { throw std::runtime_error("start_syncing() not supported"); } diff --git a/src/wallet/monero_wallet_core.cpp b/src/wallet/monero_wallet_core.cpp index 5b22d7c..da453f2 100644 --- a/src/wallet/monero_wallet_core.cpp +++ b/src/wallet/monero_wallet_core.cpp @@ -1372,21 +1372,15 @@ namespace monero { return result; } - /** - * Start automatic syncing as its own thread. - */ - void monero_wallet_core::start_syncing(uint32_t sync_rate_in_seconds) { + void monero_wallet_core::start_syncing(uint64_t sync_period_in_ms) { if (!m_is_connected) throw std::runtime_error("Wallet is not connected to daemon"); - m_syncing_interval = sync_rate_in_seconds * 1000; // set sync rate // TODO: use ms instead of seconds? + m_syncing_interval = sync_period_in_ms; if (!m_syncing_enabled) { m_syncing_enabled = true; - run_sync_loop(); // sync wallet on loop in background + run_sync_loop(); // sync wallet on loop in background } } - /** - * Stop automatic syncing as its own thread. - */ void monero_wallet_core::stop_syncing() { m_syncing_enabled = false; m_w2->stop(); diff --git a/src/wallet/monero_wallet_core.h b/src/wallet/monero_wallet_core.h index 2ffb9cd..46f8ae1 100644 --- a/src/wallet/monero_wallet_core.h +++ b/src/wallet/monero_wallet_core.h @@ -204,7 +204,7 @@ namespace monero { monero_sync_result sync(monero_wallet_listener& listener) override; monero_sync_result sync(uint64_t start_height) override; monero_sync_result sync(uint64_t start_height, monero_wallet_listener& listener) override; - void start_syncing(uint32_t sync_rate) override; + void start_syncing(uint64_t sync_period_in_ms) override; void stop_syncing() override; void rescan_spent() override; void rescan_blockchain() override;