mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-12-23 13:47:47 +00:00
wallet2: fix transactions not considering rct inputs
I broke this very recently in 2bf029be17
and didn't notice in time
This commit is contained in:
parent
3473af00ad
commit
bceaf4b788
2 changed files with 11 additions and 11 deletions
|
@ -3315,7 +3315,7 @@ uint64_t wallet2::get_per_kb_fee()
|
||||||
// transactions will be required
|
// transactions will be required
|
||||||
std::vector<wallet2::pending_tx> wallet2::create_transactions(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t> extra, bool trusted_daemon)
|
std::vector<wallet2::pending_tx> wallet2::create_transactions(std::vector<cryptonote::tx_destination_entry> dsts, const size_t fake_outs_count, const uint64_t unlock_time, uint32_t priority, const std::vector<uint8_t> extra, bool trusted_daemon)
|
||||||
{
|
{
|
||||||
const std::vector<size_t> unused_transfers_indices = select_available_outputs_from_histogram(fake_outs_count + 1, true, true, trusted_daemon);
|
const std::vector<size_t> unused_transfers_indices = select_available_outputs_from_histogram(fake_outs_count + 1, true, true, true, trusted_daemon);
|
||||||
|
|
||||||
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 = get_per_kb_fee();
|
const uint64_t fee_per_kb = get_per_kb_fee();
|
||||||
|
@ -4120,7 +4120,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp
|
||||||
THROW_WALLET_EXCEPTION_IF(needed_money == 0, error::zero_destination);
|
THROW_WALLET_EXCEPTION_IF(needed_money == 0, error::zero_destination);
|
||||||
|
|
||||||
// gather all our dust and non dust outputs
|
// gather all our dust and non dust outputs
|
||||||
const std::vector<size_t> unused_indices = select_available_outputs_from_histogram(fake_outs_count + 1, true, true, trusted_daemon);
|
const std::vector<size_t> unused_indices = select_available_outputs_from_histogram(fake_outs_count + 1, true, true, true, trusted_daemon);
|
||||||
for (size_t i: unused_indices)
|
for (size_t i: unused_indices)
|
||||||
{
|
{
|
||||||
const transfer_details& td = m_transfers[i];
|
const transfer_details& td = m_transfers[i];
|
||||||
|
@ -4614,7 +4614,7 @@ std::vector<uint64_t> wallet2::get_unspent_amounts_vector()
|
||||||
for (const auto &td: m_transfers)
|
for (const auto &td: m_transfers)
|
||||||
{
|
{
|
||||||
if (!td.m_spent)
|
if (!td.m_spent)
|
||||||
set.insert(td.amount());
|
set.insert(td.is_rct() ? 0 : td.amount());
|
||||||
}
|
}
|
||||||
std::vector<uint64_t> vector;
|
std::vector<uint64_t> vector;
|
||||||
vector.reserve(set.size());
|
vector.reserve(set.size());
|
||||||
|
@ -4625,7 +4625,7 @@ std::vector<uint64_t> wallet2::get_unspent_amounts_vector()
|
||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
std::vector<size_t> wallet2::select_available_outputs_from_histogram(uint64_t count, bool atleast, bool unlocked, bool trusted_daemon)
|
std::vector<size_t> wallet2::select_available_outputs_from_histogram(uint64_t count, bool atleast, bool unlocked, bool allow_rct, bool trusted_daemon)
|
||||||
{
|
{
|
||||||
epee::json_rpc::request<cryptonote::COMMAND_RPC_GET_OUTPUT_HISTOGRAM::request> req_t = AUTO_VAL_INIT(req_t);
|
epee::json_rpc::request<cryptonote::COMMAND_RPC_GET_OUTPUT_HISTOGRAM::request> req_t = AUTO_VAL_INIT(req_t);
|
||||||
epee::json_rpc::response<cryptonote::COMMAND_RPC_GET_OUTPUT_HISTOGRAM::response, std::string> resp_t = AUTO_VAL_INIT(resp_t);
|
epee::json_rpc::response<cryptonote::COMMAND_RPC_GET_OUTPUT_HISTOGRAM::response, std::string> resp_t = AUTO_VAL_INIT(resp_t);
|
||||||
|
@ -4640,7 +4640,7 @@ std::vector<size_t> wallet2::select_available_outputs_from_histogram(uint64_t co
|
||||||
req_t.params.unlocked = unlocked;
|
req_t.params.unlocked = unlocked;
|
||||||
bool r = net_utils::invoke_http_json("/json_rpc", req_t, resp_t, m_http_client);
|
bool r = net_utils::invoke_http_json("/json_rpc", req_t, resp_t, m_http_client);
|
||||||
m_daemon_rpc_mutex.unlock();
|
m_daemon_rpc_mutex.unlock();
|
||||||
THROW_WALLET_EXCEPTION_IF(!r, error::no_connection_to_daemon, "select_available_unmixable_outputs");
|
THROW_WALLET_EXCEPTION_IF(!r, error::no_connection_to_daemon, "select_available_outputs_from_histogram");
|
||||||
THROW_WALLET_EXCEPTION_IF(resp_t.result.status == CORE_RPC_STATUS_BUSY, error::daemon_busy, "get_output_histogram");
|
THROW_WALLET_EXCEPTION_IF(resp_t.result.status == CORE_RPC_STATUS_BUSY, error::daemon_busy, "get_output_histogram");
|
||||||
THROW_WALLET_EXCEPTION_IF(resp_t.result.status != CORE_RPC_STATUS_OK, error::get_histogram_error, resp_t.result.status);
|
THROW_WALLET_EXCEPTION_IF(resp_t.result.status != CORE_RPC_STATUS_OK, error::get_histogram_error, resp_t.result.status);
|
||||||
|
|
||||||
|
@ -4650,10 +4650,10 @@ std::vector<size_t> wallet2::select_available_outputs_from_histogram(uint64_t co
|
||||||
mixable.insert(i.amount);
|
mixable.insert(i.amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return select_available_outputs([mixable, atleast](const transfer_details &td) {
|
return select_available_outputs([mixable, atleast, allow_rct](const transfer_details &td) {
|
||||||
if (td.is_rct())
|
if (!allow_rct && td.is_rct())
|
||||||
return false;
|
return false;
|
||||||
const uint64_t amount = td.amount();
|
const uint64_t amount = td.is_rct() ? 0 : td.amount();
|
||||||
if (atleast) {
|
if (atleast) {
|
||||||
if (mixable.find(amount) != mixable.end())
|
if (mixable.find(amount) != mixable.end())
|
||||||
return true;
|
return true;
|
||||||
|
@ -4698,14 +4698,14 @@ std::vector<size_t> wallet2::select_available_unmixable_outputs(bool trusted_dae
|
||||||
{
|
{
|
||||||
// request all outputs with less than 3 instances
|
// request all outputs with less than 3 instances
|
||||||
const size_t min_mixin = use_fork_rules(5, 10) ? 4 : 2; // v5 increases min mixin from 2 to 4
|
const size_t min_mixin = use_fork_rules(5, 10) ? 4 : 2; // v5 increases min mixin from 2 to 4
|
||||||
return select_available_outputs_from_histogram(min_mixin + 1, false, true, trusted_daemon);
|
return select_available_outputs_from_histogram(min_mixin + 1, false, true, false, trusted_daemon);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
std::vector<size_t> wallet2::select_available_mixable_outputs(bool trusted_daemon)
|
std::vector<size_t> wallet2::select_available_mixable_outputs(bool trusted_daemon)
|
||||||
{
|
{
|
||||||
// request all outputs with at least 3 instances, so we can use mixin 2 with
|
// request all outputs with at least 3 instances, so we can use mixin 2 with
|
||||||
const size_t min_mixin = use_fork_rules(5, 10) ? 4 : 2; // v5 increases min mixin from 2 to 4
|
const size_t min_mixin = use_fork_rules(5, 10) ? 4 : 2; // v5 increases min mixin from 2 to 4
|
||||||
return select_available_outputs_from_histogram(min_mixin + 1, true, true, trusted_daemon);
|
return select_available_outputs_from_histogram(min_mixin + 1, true, true, true, trusted_daemon);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
std::vector<wallet2::pending_tx> wallet2::create_unmixable_sweep_transactions(bool trusted_daemon)
|
std::vector<wallet2::pending_tx> wallet2::create_unmixable_sweep_transactions(bool trusted_daemon)
|
||||||
|
|
|
@ -533,7 +533,7 @@ namespace tools
|
||||||
* \brief Calculates the approximate blockchain height from current date/time.
|
* \brief Calculates the approximate blockchain height from current date/time.
|
||||||
*/
|
*/
|
||||||
uint64_t get_approximate_blockchain_height() const;
|
uint64_t get_approximate_blockchain_height() const;
|
||||||
std::vector<size_t> select_available_outputs_from_histogram(uint64_t count, bool atleast, bool unlocked, bool trusted_daemon);
|
std::vector<size_t> select_available_outputs_from_histogram(uint64_t count, bool atleast, bool unlocked, bool allow_rct, bool trusted_daemon);
|
||||||
std::vector<size_t> select_available_outputs(const std::function<bool(const transfer_details &td)> &f);
|
std::vector<size_t> select_available_outputs(const std::function<bool(const transfer_details &td)> &f);
|
||||||
std::vector<size_t> select_available_unmixable_outputs(bool trusted_daemon);
|
std::vector<size_t> select_available_unmixable_outputs(bool trusted_daemon);
|
||||||
std::vector<size_t> select_available_mixable_outputs(bool trusted_daemon);
|
std::vector<size_t> select_available_mixable_outputs(bool trusted_daemon);
|
||||||
|
|
Loading…
Reference in a new issue