mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-17 23:31:32 +02:00
replace mixin with ring size
This commit is contained in:
@@ -192,7 +192,7 @@ namespace monero {
|
||||
tgt->m_is_miner_tx = src->m_is_miner_tx;
|
||||
tgt->m_payment_id = src->m_payment_id;
|
||||
tgt->m_fee = src->m_fee;
|
||||
tgt->m_mixin = src->m_mixin;
|
||||
tgt->m_ring_size = src->m_ring_size;
|
||||
tgt->m_do_not_relay = src->m_do_not_relay;
|
||||
tgt->m_is_relayed = src->m_is_relayed;
|
||||
tgt->m_is_confirmed = src->m_is_confirmed;
|
||||
@@ -248,7 +248,7 @@ namespace monero {
|
||||
if (m_is_miner_tx != boost::none) node.put("isMinerTx", *m_is_miner_tx);
|
||||
if (m_payment_id != boost::none) node.put("paymentId", *m_payment_id);
|
||||
if (m_fee != boost::none) node.put("fee", *m_fee);
|
||||
if (m_mixin != boost::none) node.put("mixin", *m_mixin);
|
||||
if (m_ring_size != boost::none) node.put("ringSize", *m_ring_size);
|
||||
if (m_do_not_relay != boost::none) node.put("doNotRelay", *m_do_not_relay);
|
||||
if (m_is_relayed != boost::none) node.put("isRelayed", *m_is_relayed);
|
||||
if (m_is_confirmed != boost::none) node.put("isConfirmed", *m_is_confirmed);
|
||||
@@ -313,7 +313,7 @@ namespace monero {
|
||||
m_version = gen_utils::reconcile(m_version, other->m_version);
|
||||
m_payment_id = gen_utils::reconcile(m_payment_id, other->m_payment_id);
|
||||
m_fee = gen_utils::reconcile(m_fee, other->m_fee, "tx fee");
|
||||
m_mixin = gen_utils::reconcile(m_mixin, other->m_mixin, "tx m_mixin");
|
||||
m_ring_size = gen_utils::reconcile(m_ring_size, other->m_ring_size, "tx m_ring_size");
|
||||
m_is_confirmed = gen_utils::reconcile(m_is_confirmed, other->m_is_confirmed);
|
||||
m_do_not_relay = gen_utils::reconcile(m_do_not_relay, other->m_do_not_relay);
|
||||
m_is_relayed = gen_utils::reconcile(m_is_relayed, other->m_is_relayed);
|
||||
|
||||
@@ -170,7 +170,7 @@ namespace monero {
|
||||
boost::optional<bool> m_is_miner_tx;
|
||||
boost::optional<string> m_payment_id;
|
||||
boost::optional<uint64_t> m_fee;
|
||||
boost::optional<uint32_t> m_mixin;
|
||||
boost::optional<uint32_t> m_ring_size;
|
||||
boost::optional<bool> m_do_not_relay;
|
||||
boost::optional<bool> m_is_relayed;
|
||||
boost::optional<bool> m_is_confirmed;
|
||||
|
||||
@@ -435,7 +435,6 @@ shared_ptr<monero_send_request> monero_utils::deserialize_send_request(const str
|
||||
}
|
||||
else if (key == string("paymentId")) send_request->m_payment_id = it->second.data();
|
||||
else if (key == string("priority")) throw runtime_error("deserialize_send_request() priority not implemented");
|
||||
else if (key == string("mixin")) send_request->m_mixin = it->second.get_value<uint32_t>();
|
||||
else if (key == string("ringSize")) send_request->m_ring_size = it->second.get_value<uint32_t>();
|
||||
else if (key == string("fee")) send_request->m_fee = it->second.get_value<uint64_t>();
|
||||
else if (key == string("accountIndex")) send_request->m_account_index = it->second.get_value<uint32_t>();
|
||||
|
||||
@@ -1979,7 +1979,7 @@ namespace monero {
|
||||
tx->m_in_tx_pool = !tx->m_do_not_relay.get();
|
||||
if (!tx->m_is_failed.get() && tx->m_is_relayed.get()) tx->m_is_double_spend_seen = false; // TODO: test and handle if true
|
||||
tx->m_num_confirmations = 0;
|
||||
tx->m_mixin = request.m_mixin;
|
||||
tx->m_ring_size = request.m_ring_size;
|
||||
tx->m_unlock_time = request.m_unlock_time == boost::none ? 0 : request.m_unlock_time.get();
|
||||
tx->m_is_locked = true;
|
||||
if (tx->m_is_relayed.get()) tx->m_last_relayed_timestamp = static_cast<uint64_t>(time(NULL)); // set last relayed timestamp to current time iff relayed // TODO monero core: this should be encapsulated in wallet2
|
||||
@@ -2158,7 +2158,7 @@ namespace monero {
|
||||
tx->m_in_tx_pool = !do_not_relay;
|
||||
if (!tx->m_is_failed.get() && tx->m_is_relayed.get()) tx->m_is_double_spend_seen = false; // TODO: test and handle if true
|
||||
tx->m_num_confirmations = 0;
|
||||
tx->m_mixin = request.m_mixin;
|
||||
tx->m_ring_size = request.m_ring_size;
|
||||
tx->m_unlock_time = request.m_unlock_time == boost::none ? 0 : request.m_unlock_time.get();
|
||||
if (tx->m_is_relayed.get()) tx->m_last_relayed_timestamp = static_cast<uint64_t>(time(NULL)); // set last relayed timestamp to current time iff relayed // TODO monero core: this should be encapsulated in wallet2
|
||||
out_transfer->m_account_index = request.m_account_index;
|
||||
@@ -2210,10 +2210,10 @@ namespace monero {
|
||||
}
|
||||
|
||||
// create transaction
|
||||
uint64_t m_mixin = m_w2->adjust_mixin(request.m_ring_size == boost::none ? 0 : request.m_ring_size.get() - 1);
|
||||
uint64_t mixin = m_w2->adjust_mixin(request.m_ring_size == boost::none ? 0 : request.m_ring_size.get() - 1);
|
||||
uint32_t priority = m_w2->adjust_priority(request.m_priority == boost::none ? 0 : request.m_priority.get());
|
||||
uint64_t m_unlock_time = request.m_unlock_time == boost::none ? 0 : request.m_unlock_time.get();
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_w2->create_transactions_single(ki, dsts[0].addr, dsts[0].is_subaddress, 1, m_mixin, m_unlock_time, priority, extra);
|
||||
uint64_t unlock_time = request.m_unlock_time == boost::none ? 0 : request.m_unlock_time.get();
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_w2->create_transactions_single(ki, dsts[0].addr, dsts[0].is_subaddress, 1, mixin, unlock_time, priority, extra);
|
||||
|
||||
// validate created transaction
|
||||
if (ptx_vector.empty()) throw runtime_error("No outputs found");
|
||||
@@ -2273,7 +2273,7 @@ namespace monero {
|
||||
tx->m_in_tx_pool = !tx->m_do_not_relay.get();
|
||||
if (!tx->m_is_failed.get() && tx->m_is_relayed.get()) tx->m_is_double_spend_seen = false; // TODO: test and handle if true
|
||||
tx->m_num_confirmations = 0;
|
||||
tx->m_mixin = request.m_mixin;
|
||||
tx->m_ring_size = request.m_ring_size;
|
||||
tx->m_unlock_time = request.m_unlock_time == boost::none ? 0 : request.m_unlock_time.get();
|
||||
tx->m_is_locked = true;
|
||||
if (tx->m_is_relayed.get()) tx->m_last_relayed_timestamp = static_cast<uint64_t>(time(NULL)); // set last relayed timestamp to current time iff relayed // TODO monero core: this should be encapsulated in wallet2
|
||||
@@ -2359,7 +2359,7 @@ namespace monero {
|
||||
tx->m_in_tx_pool = !tx->m_do_not_relay.get();
|
||||
if (!tx->m_is_failed.get() && tx->m_is_relayed.get()) tx->m_is_double_spend_seen = false; // TODO: test and handle if true
|
||||
tx->m_num_confirmations = 0;
|
||||
//tx->m_mixin = request.m_mixin; // TODO: how to get?
|
||||
//tx->m_ring_size = request.m_ring_size; // TODO: how to get?
|
||||
tx->m_unlock_time = 0;
|
||||
if (tx->m_is_relayed.get()) tx->m_last_relayed_timestamp = static_cast<uint64_t>(time(NULL)); // set last relayed timestamp to current time iff relayed // TODO monero core: this should be encapsulated in wallet2
|
||||
out_transfer->m_destinations[0]->m_amount = *tx_amounts_iter;
|
||||
@@ -2439,7 +2439,7 @@ namespace monero {
|
||||
tx->m_output_sum = 0;
|
||||
tx->m_change_amount = 0;
|
||||
tx->m_num_dummy_outputs = 0;
|
||||
tx->m_mixin = std::numeric_limits<uint32_t>::max() - 1; // smaller ring sizes will overwrite // TODO: remove - 1 when switched to ring size
|
||||
tx->m_ring_size = std::numeric_limits<uint32_t>::max(); // smaller ring sizes will overwrite
|
||||
|
||||
const tools::wallet2::tx_construction_data &cd = tx_constructions[n];
|
||||
std::vector<cryptonote::tx_extra_field> tx_extra_fields;
|
||||
@@ -2470,8 +2470,8 @@ namespace monero {
|
||||
{
|
||||
tx->m_input_sum = tx->m_input_sum.get() + cd.sources[s].amount;
|
||||
size_t ring_size = cd.sources[s].outputs.size();
|
||||
if (ring_size < tx->m_mixin.get() + 1)
|
||||
tx->m_mixin = ring_size - 1; // TODO: switch to m_ring_size
|
||||
if (ring_size < tx->m_ring_size.get())
|
||||
tx->m_ring_size = ring_size;
|
||||
}
|
||||
for (size_t d = 0; d < cd.splitted_dsts.size(); ++d)
|
||||
{
|
||||
|
||||
@@ -683,7 +683,6 @@ namespace monero {
|
||||
}
|
||||
m_payment_id = request.m_payment_id;
|
||||
m_priority = request.m_priority;
|
||||
m_mixin = request.m_mixin;
|
||||
m_ring_size = request.m_ring_size;
|
||||
m_fee = request.m_fee;
|
||||
m_account_index = request.m_account_index;
|
||||
@@ -707,7 +706,6 @@ namespace monero {
|
||||
if (!m_destinations.empty()) node.add_child("destinations", monero_utils::to_property_tree(m_destinations));
|
||||
if (m_payment_id != boost::none) node.put("paymentId", *m_payment_id);
|
||||
if (m_priority != boost::none) node.put("priority", *m_priority);
|
||||
if (m_mixin != boost::none) node.put("mixin", *m_mixin);
|
||||
if (m_ring_size != boost::none) node.put("ringSize", *m_ring_size);
|
||||
if (m_account_index != boost::none) node.put("accountIndex", *m_account_index);
|
||||
if (!m_subaddress_indices.empty()) node.add_child("subaddressIndices", monero_utils::to_property_tree(m_subaddress_indices));
|
||||
|
||||
@@ -348,7 +348,6 @@ namespace monero {
|
||||
vector<shared_ptr<monero_destination>> m_destinations;
|
||||
boost::optional<string> m_payment_id;
|
||||
boost::optional<monero_send_priority> m_priority;
|
||||
boost::optional<uint32_t> m_mixin;
|
||||
boost::optional<uint32_t> m_ring_size;
|
||||
boost::optional<uint64_t> m_fee;
|
||||
boost::optional<uint32_t> m_account_index;
|
||||
|
||||
Reference in New Issue
Block a user