From 985f61a4ec7ebc2387487f49dab59f21ae010dbc Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sat, 15 Oct 2016 18:41:34 +0100 Subject: [PATCH 1/2] wallet: force 0 mixin transactions to use pre-rct txes rct transactions does not support 0 mixin, and those are now typically dust sweep transactions, for which a lower fee is a must. --- src/wallet/wallet2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 98dbc4fd..74c2f7d8 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3697,7 +3697,7 @@ std::vector wallet2::create_transactions_from(const crypton uint64_t needed_fee, available_for_fee = 0; uint64_t upper_transaction_size_limit = get_upper_tranaction_size_limit(); - const bool use_rct = use_fork_rules(4, 0); + const bool use_rct = fake_outs_count > 0 && use_fork_rules(4, 0); const bool use_new_fee = use_fork_rules(3, -720 * 14); const uint64_t fee_per_kb = use_new_fee ? FEE_PER_KB : FEE_PER_KB_OLD; const uint64_t fee_multiplier = get_fee_multiplier(priority, use_new_fee); From 8231997b6674b8cd3e01ca242ac71fd829432c8e Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sat, 15 Oct 2016 19:18:52 +0100 Subject: [PATCH 2/2] simplewallet: fix sweep_all misreporting sweeped amount for rct outputs RingCT outputs will be 0 in the vin, so we need to get the actual amount from elsewhere. --- src/simplewallet/simplewallet.cpp | 14 ++++---------- src/wallet/wallet2.cpp | 6 ++++++ src/wallet/wallet2.h | 1 + 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index b2711347..64cf8280 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -2897,11 +2897,8 @@ bool simple_wallet::sweep_unmixable(const std::vector &args_) for (size_t n = 0; n < ptx_vector.size(); ++n) { total_fee += ptx_vector[n].fee; - for (const auto &vin: ptx_vector[n].tx.vin) - { - if (vin.type() == typeid(txin_to_key)) - total_unmixable += boost::get(vin).amount; - } + for (auto i: ptx_vector[n].selected_transfers) + total_unmixable += m_wallet->get_transfer_details(i).amount(); } std::string prompt_str = tr("Sweeping ") + print_money(total_unmixable); @@ -3152,11 +3149,8 @@ bool simple_wallet::sweep_all(const std::vector &args_) for (size_t n = 0; n < ptx_vector.size(); ++n) { total_fee += ptx_vector[n].fee; - for (const auto &vin: ptx_vector[n].tx.vin) - { - if (vin.type() == typeid(txin_to_key)) - total_sent += boost::get(vin).amount; - } + for (auto i: ptx_vector[n].selected_transfers) + total_sent += m_wallet->get_transfer_details(i).amount(); } std::string prompt_str; diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 74c2f7d8..5dfb8468 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3978,6 +3978,12 @@ uint64_t wallet2::get_num_rct_outputs() return resp_t.result.histogram[0].instances; } //---------------------------------------------------------------------------------------------------- +const wallet2::transfer_details &wallet2::get_transfer_details(size_t idx) const +{ + THROW_WALLET_EXCEPTION_IF(idx >= m_transfers.size(), error::wallet_internal_error, "Bad transfer index"); + return m_transfers[idx]; +} +//---------------------------------------------------------------------------------------------------- std::vector wallet2::select_available_unmixable_outputs(bool trusted_daemon) { // request all outputs with less than 3 instances diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index a039c92d..e445ebe1 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -447,6 +447,7 @@ namespace tools bool get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key) const; uint64_t get_num_rct_outputs(); + const transfer_details &get_transfer_details(size_t idx) const; void get_hard_fork_info(uint8_t version, uint64_t &earliest_height); bool use_fork_rules(uint8_t version, int64_t early_blocks = 0);