From 199e47e07629fb237ea94588ae9ae8fd5fc33fc1 Mon Sep 17 00:00:00 2001 From: ncoggins Date: Mon, 20 May 2024 09:28:44 +0100 Subject: [PATCH] small fix to prevent wallets from abandoning scanning when encountering protocol_tx not intended for them - duh! --- src/version.cpp.in | 2 +- src/wallet/wallet2.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/version.cpp.in b/src/version.cpp.in index 252e76b37..53e93fcd0 100644 --- a/src/version.cpp.in +++ b/src/version.cpp.in @@ -1,5 +1,5 @@ #define DEF_SALVIUM_VERSION_TAG "7f6b8da" -#define DEF_SALVIUM_VERSION "0.0.5" +#define DEF_SALVIUM_VERSION "0.0.7" #define DEF_MONERO_VERSION_TAG "@VERSIONTAG@" #define DEF_MONERO_VERSION "0.18.2.2" #define DEF_MONERO_RELEASE_NAME "Zero" diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 2a337c706..7a24577d6 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2236,6 +2236,10 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote // Find the TX public key for P_change //auto search = m_protocol_txs.find(pk_change); auto search = m_protocol_txs.find(output_public_key); + if (search == m_protocol_txs.end()) { + LOG_PRINT_L3("failed to locate protocol_tx entry for this vout - skipping"); + continue; + } THROW_WALLET_EXCEPTION_IF(search == m_protocol_txs.end(), error::wallet_internal_error, "failed to locate protocol_tx entry to permit source usage"); size_t idx = search->second; THROW_WALLET_EXCEPTION_IF(idx >= get_num_transfer_details(), error::wallet_internal_error, "cannot locate protocol_txs index in m_transfers"); @@ -2727,10 +2731,10 @@ void wallet2::process_new_transaction(const crypto::hash &txid, const cryptonote payment.m_fee = fee; // SRCG - figure out what this needs to be (pretty sure we should never get here with CONVERT!) payment.m_amount = source_asset == dest_asset ? i.second[dest_asset] : tx.amount_burnt; - payment.m_asset_type = dest_asset; + payment.m_asset_type = (tx.type == cryptonote::transaction_type::PROTOCOL) ? "SAL" : dest_asset; payment.m_amounts = tx_amounts_individual_outs[i.first]; payment.m_block_height = height; - payment.m_unlock_time = tx.unlock_time; + payment.m_unlock_time = tx.unlock_time; // SRCG: this is incorrect - work out which vout entry it is and query that payment.m_timestamp = ts; payment.m_coinbase = miner_tx; payment.m_subaddr_index = i.first;