From 5c5b0fd0489fce1ef7c9c33430da9c3d3f6bdc07 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 20 Sep 2017 10:34:45 +0100 Subject: [PATCH 1/2] wallet2: print unused indices on a single line Decreases log spam massively on large wallets --- src/wallet/wallet2.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index f72d281c7..c5254f388 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include "include_base_utils.h" using namespace epee; @@ -419,6 +420,20 @@ static void throw_on_rpc_response_error(const boost::optional &stat THROW_WALLET_EXCEPTION_IF(*status != CORE_RPC_STATUS_OK, tools::error::wallet_generic_rpc_error, method, *status); } +std::string strjoin(const std::vector &V, const char *sep) +{ + std::stringstream ss; + bool first = true; + for (const auto &v: V) + { + if (!first) + ss << sep; + ss << std::to_string(v); + first = false; + } + return ss.str(); +} + } //namespace namespace tools @@ -4437,12 +4452,8 @@ std::vector wallet2::create_transactions_2(std::vector Date: Wed, 20 Sep 2017 10:35:15 +0100 Subject: [PATCH 2/2] wallet2: fix exception on split txes --- src/wallet/wallet2.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index c5254f388..d55e9b044 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -4353,7 +4353,8 @@ std::vector wallet2::create_transactions_2(std::vector dsts.size(), error::wallet_internal_error, "original_output_index too large"); + THROW_WALLET_EXCEPTION_IF(original_output_index > dsts.size(), error::wallet_internal_error, + std::string("original_output_index too large: ") + std::to_string(original_output_index) + " > " + std::to_string(dsts.size())); if (original_output_index == dsts.size()) dsts.push_back(tx_destination_entry(0,addr)); THROW_WALLET_EXCEPTION_IF(memcmp(&dsts[original_output_index].addr, &addr, sizeof(addr)), error::wallet_internal_error, "Mismatched destination address"); @@ -4627,6 +4628,7 @@ std::vector wallet2::create_transactions_2(std::vector