mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-23 03:48:52 +00:00
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.
This commit is contained in:
parent
985f61a4ec
commit
8231997b66
@ -2897,11 +2897,8 @@ bool simple_wallet::sweep_unmixable(const std::vector<std::string> &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<txin_to_key>(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<std::string> &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<txin_to_key>(vin).amount;
|
||||
}
|
||||
for (auto i: ptx_vector[n].selected_transfers)
|
||||
total_sent += m_wallet->get_transfer_details(i).amount();
|
||||
}
|
||||
|
||||
std::string prompt_str;
|
||||
|
@ -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<size_t> wallet2::select_available_unmixable_outputs(bool trusted_daemon)
|
||||
{
|
||||
// request all outputs with less than 3 instances
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user