forked from lthn/blockchain
added m_whitelisted_assets to serialized state(to hold correct assets balances on open time)
This commit is contained in:
parent
bfb7e22ae7
commit
5bd815e66f
3 changed files with 11 additions and 7 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ namespace tools
|
|||
std::unordered_map<crypto::hash, crypto::secret_key> m_tx_keys;
|
||||
std::unordered_map<crypto::public_key, wallet_own_asset_context> m_own_asset_descriptors;
|
||||
std::unordered_map<crypto::public_key, currency::asset_descriptor_base> m_custom_assets; //assets that manually added by user
|
||||
std::unordered_map<crypto::public_key, currency::asset_descriptor_base> m_whitelisted_assets; //assets that whitelisted
|
||||
escrow_contracts_container m_contracts;
|
||||
std::multimap<uint64_t, htlc_expiration_trigger> 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<uint64_t> m_last_sync_percent = 0;
|
||||
mutable uint64_t m_current_wallet_file_size = 0;
|
||||
|
||||
|
||||
//===============================================================
|
||||
template <class t_archive>
|
||||
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<bool> m_stop;
|
||||
mutable std::unordered_map<crypto::public_key, currency::asset_descriptor_base> m_whitelisted_assets; //assets that whitelisted
|
||||
std::atomic<bool> whitelist_updated = false;
|
||||
std::shared_ptr<i_core_proxy> m_core_proxy;
|
||||
std::shared_ptr<i_wallet2_callback> m_wcallback;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue