Merge pull request #8123

4446cc8 wallet inits cache if file and blob missing (woodser)
This commit is contained in:
luigi1111 2022-01-24 15:15:11 -05:00
commit d94715fd71
No known key found for this signature in database
GPG Key ID: F4ACA0183641E010

View File

@ -5709,13 +5709,14 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass
wallet_keys_unlocker unlocker(*this, m_ask_password == AskPasswordToDecrypt && !m_unattended && !m_watch_only, password); wallet_keys_unlocker unlocker(*this, m_ask_password == AskPasswordToDecrypt && !m_unattended && !m_watch_only, password);
//keys loaded ok! //keys loaded ok!
//try to load wallet file. but even if we failed, it is not big problem //try to load wallet cache. but even if we failed, it is not big problem
if (use_fs && (!boost::filesystem::exists(m_wallet_file, e) || e)) bool cache_missing = use_fs ? (!boost::filesystem::exists(m_wallet_file, e) || e) : cache_buf.empty();
if (cache_missing)
{ {
LOG_PRINT_L0("file not found: " << m_wallet_file << ", starting with empty blockchain"); LOG_PRINT_L0("wallet cache missing: " << m_wallet_file << ", starting with empty blockchain");
m_account_public_address = m_account.get_keys().m_account_address; m_account_public_address = m_account.get_keys().m_account_address;
} }
else if (use_fs || !cache_buf.empty()) else
{ {
wallet2::cache_file_data cache_file_data; wallet2::cache_file_data cache_file_data;
std::string cache_file_buf; std::string cache_file_buf;