mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-22 15:32:24 +00:00
Merge pull request #3991
798dfcf
wallet: allow unspendable unmixable outputs to be discarded (stoffu)
This commit is contained in:
commit
5eb2e01216
3 changed files with 25 additions and 0 deletions
|
@ -4940,6 +4940,20 @@ bool simple_wallet::sweep_unmixable(const std::vector<std::string> &args_)
|
||||||
commit_or_save(ptx_vector, m_do_not_relay);
|
commit_or_save(ptx_vector, m_do_not_relay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (const tools::error::not_enough_unlocked_money& e)
|
||||||
|
{
|
||||||
|
fail_msg_writer() << tr("Not enough money in unlocked balance");
|
||||||
|
std::string accepted = input_line((boost::format(tr("Discarding %s of unmixable outputs that cannot be spent, which can be undone by \"rescan_spent\". Is this okay? (Y/Yes/N/No): ")) % print_money(e.available())).str());
|
||||||
|
if (std::cin.eof())
|
||||||
|
return true;
|
||||||
|
if (command_line::is_yes(accepted))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_wallet->discard_unmixable_outputs(is_daemon_trusted());
|
||||||
|
} catch (...) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
catch (const std::exception &e)
|
catch (const std::exception &e)
|
||||||
{
|
{
|
||||||
handle_transfer_exception(std::current_exception(), is_daemon_trusted());
|
handle_transfer_exception(std::current_exception(), is_daemon_trusted());
|
||||||
|
|
|
@ -8467,6 +8467,16 @@ std::vector<wallet2::pending_tx> wallet2::create_unmixable_sweep_transactions(bo
|
||||||
|
|
||||||
return create_transactions_from(m_account_public_address, false, unmixable_transfer_outputs, unmixable_dust_outputs, 0 /*fake_outs_count */, 0 /* unlock_time */, 1 /*priority */, std::vector<uint8_t>(), trusted_daemon);
|
return create_transactions_from(m_account_public_address, false, unmixable_transfer_outputs, unmixable_dust_outputs, 0 /*fake_outs_count */, 0 /* unlock_time */, 1 /*priority */, std::vector<uint8_t>(), trusted_daemon);
|
||||||
}
|
}
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
void wallet2::discard_unmixable_outputs(bool trusted_daemon)
|
||||||
|
{
|
||||||
|
// may throw
|
||||||
|
std::vector<size_t> unmixable_outputs = select_available_unmixable_outputs(trusted_daemon);
|
||||||
|
for (size_t idx : unmixable_outputs)
|
||||||
|
{
|
||||||
|
m_transfers[idx].m_spent = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool wallet2::get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys) const
|
bool wallet2::get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -748,6 +748,7 @@ namespace tools
|
||||||
bool sign_multisig_tx(multisig_tx_set &exported_txs, std::vector<crypto::hash> &txids);
|
bool sign_multisig_tx(multisig_tx_set &exported_txs, std::vector<crypto::hash> &txids);
|
||||||
bool sign_multisig_tx_to_file(multisig_tx_set &exported_txs, const std::string &filename, std::vector<crypto::hash> &txids);
|
bool sign_multisig_tx_to_file(multisig_tx_set &exported_txs, const std::string &filename, std::vector<crypto::hash> &txids);
|
||||||
std::vector<pending_tx> create_unmixable_sweep_transactions(bool trusted_daemon);
|
std::vector<pending_tx> create_unmixable_sweep_transactions(bool trusted_daemon);
|
||||||
|
void discard_unmixable_outputs(bool trusted_daemon);
|
||||||
bool check_connection(uint32_t *version = NULL, uint32_t timeout = 200000);
|
bool check_connection(uint32_t *version = NULL, uint32_t timeout = 200000);
|
||||||
void get_transfers(wallet2::transfer_container& incoming_transfers) const;
|
void get_transfers(wallet2::transfer_container& incoming_transfers) const;
|
||||||
void get_payments(const crypto::hash& payment_id, std::list<wallet2::payment_details>& payments, uint64_t min_height = 0, const boost::optional<uint32_t>& subaddr_account = boost::none, const std::set<uint32_t>& subaddr_indices = {}) const;
|
void get_payments(const crypto::hash& payment_id, std::list<wallet2::payment_details>& payments, uint64_t min_height = 0, const boost::optional<uint32_t>& subaddr_account = boost::none, const std::set<uint32_t>& subaddr_indices = {}) const;
|
||||||
|
|
Loading…
Reference in a new issue