Merge pull request #2491
d5a9edf2
wallet2: fix exception on split txes (moneromooo-monero)5c5b0fd0
wallet2: print unused indices on a single line (moneromooo-monero)
This commit is contained in:
commit
737717c111
|
@ -33,6 +33,7 @@
|
|||
#include <boost/format.hpp>
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include <boost/utility/value_init.hpp>
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
#include "include_base_utils.h"
|
||||
using namespace epee;
|
||||
|
||||
|
@ -430,6 +431,20 @@ static void throw_on_rpc_response_error(const boost::optional<std::string> &stat
|
|||
THROW_WALLET_EXCEPTION_IF(*status != CORE_RPC_STATUS_OK, tools::error::wallet_generic_rpc_error, method, *status);
|
||||
}
|
||||
|
||||
std::string strjoin(const std::vector<size_t> &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
|
||||
|
@ -4358,7 +4373,8 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
|||
}
|
||||
else
|
||||
{
|
||||
THROW_WALLET_EXCEPTION_IF(original_output_index > 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");
|
||||
|
@ -4457,12 +4473,8 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
|||
TX &tx = txes.back();
|
||||
|
||||
LOG_PRINT_L2("Start of loop with " << unused_transfers_indices.size() << " " << unused_dust_indices.size());
|
||||
LOG_PRINT_L2("unused_transfers_indices:");
|
||||
for (auto t: unused_transfers_indices)
|
||||
LOG_PRINT_L2(" " << t);
|
||||
LOG_PRINT_L2("unused_dust_indices:");
|
||||
for (auto t: unused_dust_indices)
|
||||
LOG_PRINT_L2(" " << t);
|
||||
LOG_PRINT_L2("unused_transfers_indices: " << strjoin(unused_transfers_indices, " "));
|
||||
LOG_PRINT_L2("unused_dust_indices:" << strjoin(unused_dust_indices, " "));
|
||||
LOG_PRINT_L2("dsts size " << dsts.size() << ", first " << (dsts.empty() ? -1 : dsts[0].amount));
|
||||
LOG_PRINT_L2("adding_fee " << adding_fee << ", use_rct " << use_rct);
|
||||
|
||||
|
@ -4636,6 +4648,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
|||
{
|
||||
LOG_PRINT_L2("We have more to pay, starting another tx");
|
||||
txes.push_back(TX());
|
||||
original_output_index = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue