Merge pull request #1224

8231997 simplewallet: fix sweep_all misreporting sweeped amount for rct outputs (moneromooo-monero)
985f61a wallet: force 0 mixin transactions to use pre-rct txes (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2016-10-22 22:15:50 +02:00
commit f800390ccc
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
3 changed files with 12 additions and 11 deletions

View file

@ -2925,11 +2925,8 @@ bool simple_wallet::sweep_unmixable(const std::vector<std::string> &args_)
for (size_t n = 0; n < ptx_vector.size(); ++n) for (size_t n = 0; n < ptx_vector.size(); ++n)
{ {
total_fee += ptx_vector[n].fee; total_fee += ptx_vector[n].fee;
for (const auto &vin: ptx_vector[n].tx.vin) for (auto i: ptx_vector[n].selected_transfers)
{ total_unmixable += m_wallet->get_transfer_details(i).amount();
if (vin.type() == typeid(txin_to_key))
total_unmixable += boost::get<txin_to_key>(vin).amount;
}
} }
std::string prompt_str = tr("Sweeping ") + print_money(total_unmixable); std::string prompt_str = tr("Sweeping ") + print_money(total_unmixable);
@ -3187,11 +3184,8 @@ bool simple_wallet::sweep_all(const std::vector<std::string> &args_)
for (size_t n = 0; n < ptx_vector.size(); ++n) for (size_t n = 0; n < ptx_vector.size(); ++n)
{ {
total_fee += ptx_vector[n].fee; total_fee += ptx_vector[n].fee;
for (const auto &vin: ptx_vector[n].tx.vin) for (auto i: ptx_vector[n].selected_transfers)
{ total_sent += m_wallet->get_transfer_details(i).amount();
if (vin.type() == typeid(txin_to_key))
total_sent += boost::get<txin_to_key>(vin).amount;
}
} }
std::string prompt_str; std::string prompt_str;

View file

@ -3737,7 +3737,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_from(const crypton
uint64_t needed_fee, available_for_fee = 0; uint64_t needed_fee, available_for_fee = 0;
uint64_t upper_transaction_size_limit = get_upper_tranaction_size_limit(); 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 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_per_kb = use_new_fee ? FEE_PER_KB : FEE_PER_KB_OLD;
const uint64_t fee_multiplier = get_fee_multiplier(priority, use_new_fee); const uint64_t fee_multiplier = get_fee_multiplier(priority, use_new_fee);
@ -4018,6 +4018,12 @@ uint64_t wallet2::get_num_rct_outputs()
return resp_t.result.histogram[0].total_instances; return resp_t.result.histogram[0].total_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<size_t> wallet2::select_available_unmixable_outputs(bool trusted_daemon) std::vector<size_t> wallet2::select_available_unmixable_outputs(bool trusted_daemon)
{ {
// request all outputs with less than 3 instances // request all outputs with less than 3 instances

View file

@ -446,6 +446,7 @@ namespace tools
bool get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key) const; bool get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key) const;
uint64_t get_num_rct_outputs(); 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); void get_hard_fork_info(uint8_t version, uint64_t &earliest_height);
bool use_fork_rules(uint8_t version, int64_t early_blocks = 0); bool use_fork_rules(uint8_t version, int64_t early_blocks = 0);