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.
This commit is contained in:
moneromooo-monero
2015-11-28 12:38:58 +00:00
parent 4061a32082
commit 62e49a5f02
5 changed files with 143 additions and 20 deletions
+9
View File
@@ -77,6 +77,8 @@ namespace cryptonote
bool run_console_handler();
void wallet_refresh_thread();
bool new_wallet(const std::string &wallet_file, const std::string& password, const crypto::secret_key& recovery_key,
bool recover, bool two_random, bool testnet, const std::string &old_language);
bool new_wallet(const std::string &wallet_file, const std::string& password, const cryptonote::account_public_address& address,
@@ -101,6 +103,7 @@ namespace cryptonote
bool set_always_confirm_transfers(const std::vector<std::string> &args = std::vector<std::string>());
bool set_store_tx_info(const std::vector<std::string> &args = std::vector<std::string>());
bool set_default_mixin(const std::vector<std::string> &args = std::vector<std::string>());
bool set_auto_refresh(const std::vector<std::string> &args = std::vector<std::string>());
bool help(const std::vector<std::string> &args = std::vector<std::string>());
bool start_mining(const std::vector<std::string> &args);
bool stop_mining(const std::vector<std::string> &args);
@@ -229,5 +232,11 @@ namespace cryptonote
std::unique_ptr<tools::wallet2> m_wallet;
epee::net_utils::http::http_simple_client m_http_client;
refresh_progress_reporter_t m_refresh_progress_reporter;
std::atomic<bool> m_auto_refresh_run;
bool m_auto_refresh_refreshing;
std::thread m_auto_refresh_thread;
std::mutex m_auto_refresh_mutex;
std::condition_variable m_auto_refresh_cond;
};
}