Move refresh height to keys file from cache file

This commit is contained in:
Howard Chu 2016-04-29 15:17:12 +01:00
parent 590c43988c
commit cebb97c913
2 changed files with 8 additions and 1 deletions

View file

@ -1058,6 +1058,9 @@ bool wallet2::store_keys(const std::string& keys_file_name, const std::string& p
value2.SetInt(m_refresh_type); value2.SetInt(m_refresh_type);
json.AddMember("refresh_type", value2, json.GetAllocator()); json.AddMember("refresh_type", value2, json.GetAllocator());
value2.SetUint64(m_refresh_from_block_height);
json.AddMember("refresh_height", value2, json.GetAllocator());
// Serialize the JSON object // Serialize the JSON object
rapidjson::StringBuffer buffer; rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer); rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
@ -1164,6 +1167,9 @@ bool wallet2::load_keys(const std::string& keys_file_name, const std::string& pa
else else
LOG_PRINT_L0("Unknown refresh-type value (" << field_refresh_type << "), using default"); LOG_PRINT_L0("Unknown refresh-type value (" << field_refresh_type << "), using default");
} }
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, refresh_height, uint64_t, Uint64, false);
if (field_refresh_height_found)
m_refresh_from_block_height = field_refresh_height;
} }
const cryptonote::account_keys& keys = m_account.get_keys(); const cryptonote::account_keys& keys = m_account.get_keys();

View file

@ -308,6 +308,7 @@ namespace tools
template <class t_archive> template <class t_archive>
inline void serialize(t_archive &a, const unsigned int ver) inline void serialize(t_archive &a, const unsigned int ver)
{ {
uint64_t dummy_refresh_height = 0; // moved to keys file
if(ver < 5) if(ver < 5)
return; return;
a & m_blockchain; a & m_blockchain;
@ -328,7 +329,7 @@ namespace tools
a & m_confirmed_txs; a & m_confirmed_txs;
if(ver < 11) if(ver < 11)
return; return;
a & m_refresh_from_block_height; a & dummy_refresh_height;
if(ver < 12) if(ver < 12)
return; return;
a & m_tx_notes; a & m_tx_notes;