diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-11-28 12:38:58 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-11-28 12:41:06 +0000 |
commit | 62e49a5f02da0963fb0303383626b2c86443d405 (patch) | |
tree | f98be933b63426d26cd3b91be7cc0db8106467d5 /src/wallet | |
parent | Merge pull request #501 (diff) | |
download | monero-62e49a5f02da0963fb0303383626b2c86443d405.tar.xz |
wallet: optional automatic refresh from the daemon
The daemon will be polled every 90 seconds for new blocks.
It is enabled by default, and can be turned on/off with
set auto-refresh 1 and set auto-refresh 0 in the wallet.
Diffstat (limited to '')
-rw-r--r-- | src/wallet/wallet2.cpp | 4 | ||||
-rw-r--r-- | src/wallet/wallet2.h | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index a6ac860c7..a5a1e5977 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -744,6 +744,9 @@ bool wallet2::store_keys(const std::string& keys_file_name, const std::string& p value2.SetUint(m_default_mixin); json.AddMember("default_mixin", value2, json.GetAllocator()); + value2.SetInt(m_auto_refresh ? 1 :0); + json.AddMember("auto_refresh", value2, json.GetAllocator()); + // Serialize the JSON object rapidjson::StringBuffer buffer; rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); @@ -828,6 +831,7 @@ void wallet2::load_keys(const std::string& keys_file_name, const std::string& pa m_store_tx_info = (json.HasMember("store_tx_keys") && (json["store_tx_keys"].GetInt() != 0)) || (json.HasMember("store_tx_info") && (json["store_tx_info"].GetInt() != 0)); m_default_mixin = json.HasMember("default_mixin") ? json["default_mixin"].GetUint() : 0; + m_auto_refresh = json.HasMember("auto_refresh") && (json["auto_refresh"].GetInt() != 0); } const cryptonote::account_keys& keys = m_account.get_keys(); diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index e036020b8..79fd2da49 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -87,10 +87,10 @@ namespace tools }; private: - wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false), m_always_confirm_transfers (false), m_store_tx_info(true), m_default_mixin(0), m_refresh_type(RefreshOptimizeCoinbase) {} + wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false), m_always_confirm_transfers (false), m_store_tx_info(true), m_default_mixin(0), m_refresh_type(RefreshOptimizeCoinbase), m_auto_refresh(true) {} public: - wallet2(bool testnet = false, bool restricted = false) : m_run(true), m_callback(0), m_testnet(testnet), m_restricted(restricted), is_old_file_format(false), m_store_tx_info(true), m_default_mixin(0), m_refresh_type(RefreshOptimizeCoinbase) {} + wallet2(bool testnet = false, bool restricted = false) : m_run(true), m_callback(0), m_testnet(testnet), m_restricted(restricted), is_old_file_format(false), m_store_tx_info(true), m_default_mixin(0), m_refresh_type(RefreshOptimizeCoinbase), m_auto_refresh(true) {} struct transfer_details { uint64_t m_block_height; @@ -330,6 +330,8 @@ namespace tools void store_tx_info(bool store) { m_store_tx_info = store; } uint32_t default_mixin() const { return m_default_mixin; } void default_mixin(uint32_t m) { m_default_mixin = m; } + bool auto_refresh() const { return m_auto_refresh; } + void auto_refresh(bool r) { m_auto_refresh = r; } bool get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key) const; @@ -397,6 +399,7 @@ namespace tools bool m_store_tx_info; /*!< request txkey to be returned in RPC, and store in the wallet cache file */ uint32_t m_default_mixin; RefreshType m_refresh_type; + bool m_auto_refresh; }; } BOOST_CLASS_VERSION(tools::wallet2, 10) |