aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-12-05 21:44:25 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-12-05 21:44:25 +0000
commitc6cfe0f26d51b8ef29ff3ecbcb651ef5e9b5b686 (patch)
treeb8ae7dc63bdedc84f5ad7c9f11adcd516b6e0113 /src/wallet
parentwallet: default auto-refresh to true for old wallets (diff)
downloadmonero-c6cfe0f26d51b8ef29ff3ecbcb651ef5e9b5b686.tar.xz
wallet: make the wallet refresh type a wallet setting
instead of a command line setting. It makes sense that is is a long lived setting.
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet2.cpp13
-rw-r--r--src/wallet/wallet2.h3
2 files changed, 15 insertions, 1 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 57c3ab7ee..5a9b96bb8 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -834,6 +834,9 @@ bool wallet2::store_keys(const std::string& keys_file_name, const std::string& p
value2.SetInt(m_auto_refresh ? 1 :0);
json.AddMember("auto_refresh", value2, json.GetAllocator());
+ value2.SetInt(m_refresh_type);
+ json.AddMember("refresh_type", value2, json.GetAllocator());
+
// Serialize the JSON object
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
@@ -897,6 +900,7 @@ void wallet2::load_keys(const std::string& keys_file_name, const std::string& pa
m_always_confirm_transfers = false;
m_default_mixin = 0;
m_auto_refresh = true;
+ m_refresh_type = RefreshType::RefreshDefault;
}
else
{
@@ -920,6 +924,15 @@ void wallet2::load_keys(const std::string& keys_file_name, const std::string& pa
|| (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);
+ m_refresh_type = RefreshType::RefreshDefault;
+ if (json.HasMember("refresh_type"))
+ {
+ int type = json["refresh_type"].GetInt();
+ if (type == RefreshFull || type == RefreshOptimizeCoinbase || type == RefreshNoCoinbase)
+ m_refresh_type = (RefreshType)type;
+ else
+ LOG_PRINT_L0("Unknown refresh-type value (" << type << "), using default");
+ }
}
const cryptonote::account_keys& keys = m_account.get_keys();
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index d6aea182d..ecf4ef3dc 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -84,6 +84,7 @@ namespace tools
RefreshFull,
RefreshOptimizeCoinbase,
RefreshNoCoinbase,
+ RefreshDefault = RefreshOptimizeCoinbase,
};
private:
@@ -244,7 +245,7 @@ namespace tools
bool refresh(uint64_t & blocks_fetched, bool& received_money, bool& ok);
void set_refresh_type(RefreshType refresh_type) { m_refresh_type = refresh_type; }
- RefreshType get_refresh_type(RefreshType refresh_type) const { return m_refresh_type; }
+ RefreshType get_refresh_type() const { return m_refresh_type; }
bool testnet() const { return m_testnet; }
bool restricted() const { return m_restricted; }