From 935feb66f519fa3552fd318ef869a8bea578f7e5 Mon Sep 17 00:00:00 2001 From: sowle Date: Sat, 16 Aug 2025 05:12:34 +0300 Subject: [PATCH] wallet: fixed/improved: set_tids_to_be_only_used_in_the_next_transfer(), get_transfer_info_by_index(), get_asset_info() --- src/wallet/wallet2.cpp | 8 +++++--- src/wallet/wallet2.h | 1 - 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 42f7ac0c..b0716dd3 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -223,8 +223,10 @@ bool wallet2::get_transfer_info_by_key_image(const crypto::key_image& ki, transf //---------------------------------------------------------------------------------------------------- bool wallet2::get_transfer_info_by_index(size_t i, transfer_details& td) { - //WLT_CHECK_AND_ASSERT_MES(i < m_transfers.size(), false, "wrong out in transaction: internal index, m_transfers.size()=" << m_transfers.size()); - td = m_transfers.at(i); + auto it = m_transfers.find(i); + if (it == m_transfers.end()) + return false; + td = it->second; return true; } //---------------------------------------------------------------------------------------------------- @@ -3865,7 +3867,7 @@ bool wallet2::get_asset_info(const crypto::public_key& asset_id, currency::asset asset_flags |= aif_custom; } - if (ask_daemon_for_unknown) + if (asset_flags == aif_none && ask_daemon_for_unknown) { if (daemon_get_asset_info(asset_id, asset_info)) { diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index ef2c3a39..f1cfd471 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -588,7 +588,6 @@ namespace tools void set_tids_to_be_only_used_in_the_next_transfer(const std::vector& tids) { - WLT_THROW_IF_FALSE_WALLET_CMN_ERR_EX(std::all_of(tids.cbegin(), tids.cend(), [&](size_t i){ return i < m_transfers.size(); }), "some transfers IDs are out of range"); m_found_free_amounts.clear(); add_transfers_to_transfers_cache(tids); }