diff options
author | Ilya Kitaev <mbg033@gmail.com> | 2016-09-28 00:35:10 +0300 |
---|---|---|
committer | Ilya Kitaev <mbg033@gmail.com> | 2016-09-28 00:35:10 +0300 |
commit | 25e5efc238bc72c0c71ae2e125288e080caa7efd (patch) | |
tree | 319d5d7e2fa3f2e4858bba6d455cc3a88e4a9d5e /src/wallet/api/wallet.cpp | |
parent | libwallet_api: explicitly return 0 in Wallet::daemonBlockChainHeight() (diff) | |
download | monero-25e5efc238bc72c0c71ae2e125288e080caa7efd.tar.xz |
libwallet_api: Wallet::setAutoRefreshInterval sanity check
Diffstat (limited to 'src/wallet/api/wallet.cpp')
-rw-r--r-- | src/wallet/api/wallet.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index e249080b1..eefb49e95 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -47,6 +47,8 @@ namespace { // copy-pasted from simplewallet static const size_t DEFAULT_MIXIN = 4; static const int DEFAULT_REFRESH_INTERVAL_MILLIS = 1000 * 10; + // limit maximum refresh interval as one minute + static const int MAX_REFRESH_INTERVAL_MILLIS = 1000 * 60 * 1; } struct Wallet2CallbackImpl : public tools::i_wallet2_callback @@ -455,7 +457,13 @@ void WalletImpl::refreshAsync() void WalletImpl::setAutoRefreshInterval(int millis) { - m_refreshIntervalMillis = millis; + if (millis > MAX_REFRESH_INTERVAL_MILLIS) { + LOG_ERROR(__FUNCTION__<< ": invalid refresh interval " << millis + << " ms, maximum allowed is " << MAX_REFRESH_INTERVAL_MILLIS << " ms"); + m_refreshIntervalMillis = MAX_REFRESH_INTERVAL_MILLIS; + } else { + m_refreshIntervalMillis = millis; + } } int WalletImpl::autoRefreshInterval() const |