aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2020-09-14 11:47:06 -0500
committerluigi1111 <luigi1111w@gmail.com>2020-09-14 11:47:06 -0500
commit9bba1a24eadbc7d23a5a58d83024df224f9cafcb (patch)
tree14923588fa97332732c6c47c0b64df12e79a0c04 /src/wallet/wallet2.cpp
parentMerge pull request #6813 (diff)
parentwallet2: fix tx sanity check triggering on pre-rct outputs (diff)
downloadmonero-9bba1a24eadbc7d23a5a58d83024df224f9cafcb.tar.xz
Merge pull request #6815
ef4325f wallet2: fix tx sanity check triggering on pre-rct outputs (monermooo-monero)
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r--src/wallet/wallet2.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index cc78060b8..26e3a5b14 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -8052,13 +8052,16 @@ std::pair<std::set<uint64_t>, size_t> outs_unique(const std::vector<std::vector<
return std::make_pair(std::move(unique), total);
}
-void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, const std::vector<size_t> &selected_transfers, size_t fake_outputs_count)
+void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>> &outs, const std::vector<size_t> &selected_transfers, size_t fake_outputs_count, bool rct)
{
std::vector<uint64_t> rct_offsets;
for (size_t attempts = 3; attempts > 0; --attempts)
{
get_outs(outs, selected_transfers, fake_outputs_count, rct_offsets);
+ if (!rct)
+ return;
+
const auto unique = outs_unique(outs);
if (tx_sanity_check(unique.first, unique.second, rct_offsets.empty() ? 0 : rct_offsets.back()))
{
@@ -8696,7 +8699,7 @@ void wallet2::transfer_selected(const std::vector<cryptonote::tx_destination_ent
THROW_WALLET_EXCEPTION_IF(subaddr_account != m_transfers[*i].m_subaddr_index.major, error::wallet_internal_error, "the tx uses funds from multiple accounts");
if (outs.empty())
- get_outs(outs, selected_transfers, fake_outputs_count); // may throw
+ get_outs(outs, selected_transfers, fake_outputs_count, false); // may throw
//prepare inputs
LOG_PRINT_L2("preparing outputs");
@@ -8897,10 +8900,12 @@ void wallet2::transfer_selected_rct(std::vector<cryptonote::tx_destination_entry
MDEBUG("We will create " << n_multisig_txes << " txes");
}
+ bool all_rct = true;
uint64_t found_money = 0;
for(size_t idx: selected_transfers)
{
found_money += m_transfers[idx].amount();
+ all_rct &= m_transfers[idx].is_rct();
}
LOG_PRINT_L2("wanted " << print_money(needed_money) << ", found " << print_money(found_money) << ", fee " << print_money(fee));
@@ -8911,7 +8916,7 @@ void wallet2::transfer_selected_rct(std::vector<cryptonote::tx_destination_entry
THROW_WALLET_EXCEPTION_IF(subaddr_account != m_transfers[*i].m_subaddr_index.major, error::wallet_internal_error, "the tx uses funds from multiple accounts");
if (outs.empty())
- get_outs(outs, selected_transfers, fake_outputs_count); // may throw
+ get_outs(outs, selected_transfers, fake_outputs_count, all_rct); // may throw
//prepare inputs
LOG_PRINT_L2("preparing outputs");