diff --git a/src/currency_core/currency_config.h b/src/currency_core/currency_config.h index 8944a143..e291cc02 100644 --- a/src/currency_core/currency_config.h +++ b/src/currency_core/currency_config.h @@ -249,8 +249,8 @@ #define WALLET_FILE_SERIALIZATION_VERSION 160 #define WALLET_FILE_LAST_SUPPORTED_VERSION 160 #else -#define WALLET_FILE_LAST_SUPPORTED_VERSION (CURRENCY_FORMATION_VERSION+75) -#define WALLET_FILE_SERIALIZATION_VERSION (CURRENCY_FORMATION_VERSION+75) +#define WALLET_FILE_LAST_SUPPORTED_VERSION (CURRENCY_FORMATION_VERSION+76) +#define WALLET_FILE_SERIALIZATION_VERSION (CURRENCY_FORMATION_VERSION+76) #endif #define CURRENT_MEMPOOL_ARCHIVE_VER (CURRENCY_FORMATION_VERSION+31) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 150867de..6c1b4c78 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3519,8 +3519,6 @@ bool wallet2::load_whitelisted_tokens() const if(!m_use_assets_whitelisting) return true; - - m_whitelisted_assets.clear(); std::string body; wallet_public::assets_whitelist aw = AUTO_VAL_INIT(aw); @@ -3536,11 +3534,14 @@ bool wallet2::load_whitelisted_tokens() const //---------------------------------------------------------------------------------------------------- bool wallet2::load_whitelisted_tokens_if_not_loaded() const { - if (m_whitelisted_assets.size()) + if (m_whitelist_updated) { return true; } - return load_whitelisted_tokens(); + if (!load_whitelisted_tokens()) + return false; + m_whitelist_updated = true; + return true; } //---------------------------------------------------------------------------------------------------- void wallet2::get_transfers(transfer_container& incoming_transfers) const diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 52471f95..8c2295fa 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -138,6 +138,7 @@ namespace tools std::unordered_map m_tx_keys; std::unordered_map m_own_asset_descriptors; std::unordered_map m_custom_assets; //assets that manually added by user + std::unordered_map m_whitelisted_assets; //assets that whitelisted escrow_contracts_container m_contracts; std::multimap m_htlcs; //map [expired_if_more_then] -> height of expiration amount_gindex_to_transfer_id_container m_active_htlcs; // map [amount; gindex] -> transfer index @@ -153,6 +154,7 @@ namespace tools std::atomic m_last_sync_percent = 0; mutable uint64_t m_current_wallet_file_size = 0; + //=============================================================== template inline void serialize(t_archive &a, const unsigned int ver) @@ -213,6 +215,7 @@ namespace tools a & m_own_asset_descriptors; a & m_custom_assets; a & m_rollback_events; + a & m_whitelisted_assets; } }; @@ -874,7 +877,7 @@ private: uint64_t m_upper_transaction_size_limit; //TODO: auto-calc this value or request from daemon, now use some fixed value std::atomic m_stop; - mutable std::unordered_map m_whitelisted_assets; //assets that whitelisted + std::atomic whitelist_updated = false; std::shared_ptr m_core_proxy; std::shared_ptr m_wcallback;