From 5c6de2fddb6d2005a508e0b0006c3e17f3926dab Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Thu, 15 Dec 2022 17:11:55 +0100 Subject: [PATCH] fixed asset duplication in balances with custom list --- src/wallet/wallet2.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 21d3bb83..e88dbacd 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3167,25 +3167,27 @@ bool wallet2::balance(std::list& balances, u { asset_descriptor_base asset_info = AUTO_VAL_INIT(asset_info); //check if asset is whitelisted or customly added - auto it = m_whitelisted_assets.find(item.first); - if (it == m_whitelisted_assets.end()) + + //check if it custom asset + auto it_cust = custom_assets_local.find(item.first); + if(it_cust == custom_assets_local.end()) { - //check if it custom asset - auto it_cust = custom_assets_local.find(item.first); - if (it_cust == custom_assets_local.end()) + auto it_local = m_whitelisted_assets.find(item.first); + if(it_local == m_whitelisted_assets.end()) { continue; } - else + else { - asset_info = it_cust->second; - custom_assets_local.erase(it_cust); + asset_info = it_local->second; } } - else + else { - asset_info = it->second; - } + asset_info = it_cust->second; + custom_assets_local.erase(it_cust); + } + balances.push_back(wallet_public::asset_balance_entry()); wallet_public::asset_balance_entry& new_item = balances.back(); static_cast(new_item) = item.second;