allow using ring size instead of mixin for rpc transfer

This commit is contained in:
cryptochangements34 2018-03-05 10:10:35 -05:00
parent 421ab3119c
commit 3d452367b0
2 changed files with 44 additions and 4 deletions

View File

@ -786,7 +786,15 @@ namespace tools
try try
{ {
uint64_t mixin = m_wallet->adjust_mixin(req.mixin); uint64_t mixin;
if(req.ring_size != 0)
{
mixin = m_wallet->adjust_mixin(req.ring_size - 1);
}
else
{
mixin = m_wallet->adjust_mixin(req.mixin);
}
uint32_t priority = m_wallet->adjust_priority(req.priority); uint32_t priority = m_wallet->adjust_priority(req.priority);
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_2(dsts, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices, m_trusted_daemon); std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_2(dsts, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices, m_trusted_daemon);
@ -838,7 +846,15 @@ namespace tools
try try
{ {
uint64_t mixin = m_wallet->adjust_mixin(req.mixin); uint64_t mixin;
if(req.ring_size != 0)
{
mixin = m_wallet->adjust_mixin(req.ring_size - 1);
}
else
{
mixin = m_wallet->adjust_mixin(req.mixin);
}
uint32_t priority = m_wallet->adjust_priority(req.priority); uint32_t priority = m_wallet->adjust_priority(req.priority);
LOG_PRINT_L2("on_transfer_split calling create_transactions_2"); LOG_PRINT_L2("on_transfer_split calling create_transactions_2");
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_2(dsts, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices, m_trusted_daemon); std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_2(dsts, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices, m_trusted_daemon);
@ -905,7 +921,15 @@ namespace tools
try try
{ {
uint64_t mixin = m_wallet->adjust_mixin(req.mixin); uint64_t mixin;
if(req.ring_size != 0)
{
mixin = m_wallet->adjust_mixin(req.ring_size - 1);
}
else
{
mixin = m_wallet->adjust_mixin(req.mixin);
}
uint32_t priority = m_wallet->adjust_priority(req.priority); uint32_t priority = m_wallet->adjust_priority(req.priority);
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_all(req.below_amount, dsts[0].addr, dsts[0].is_subaddress, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices, m_trusted_daemon); std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_all(req.below_amount, dsts[0].addr, dsts[0].is_subaddress, mixin, req.unlock_time, priority, extra, req.account_index, req.subaddr_indices, m_trusted_daemon);
@ -953,7 +977,15 @@ namespace tools
try try
{ {
uint64_t mixin = m_wallet->adjust_mixin(req.mixin); uint64_t mixin;
if(req.ring_size != 0)
{
mixin = m_wallet->adjust_mixin(req.ring_size - 1);
}
else
{
mixin = m_wallet->adjust_mixin(req.mixin);
}
uint32_t priority = m_wallet->adjust_priority(req.priority); uint32_t priority = m_wallet->adjust_priority(req.priority);
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_single(ki, dsts[0].addr, dsts[0].is_subaddress, mixin, req.unlock_time, priority, extra, m_trusted_daemon); std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_single(ki, dsts[0].addr, dsts[0].is_subaddress, mixin, req.unlock_time, priority, extra, m_trusted_daemon);

View File

@ -385,6 +385,7 @@ namespace wallet_rpc
std::set<uint32_t> subaddr_indices; std::set<uint32_t> subaddr_indices;
uint32_t priority; uint32_t priority;
uint64_t mixin; uint64_t mixin;
uint64_t ring_size;
uint64_t unlock_time; uint64_t unlock_time;
std::string payment_id; std::string payment_id;
bool get_tx_key; bool get_tx_key;
@ -398,6 +399,7 @@ namespace wallet_rpc
KV_SERIALIZE(subaddr_indices) KV_SERIALIZE(subaddr_indices)
KV_SERIALIZE(priority) KV_SERIALIZE(priority)
KV_SERIALIZE(mixin) KV_SERIALIZE(mixin)
KV_SERIALIZE_OPT(ring_size, (uint64_t)0)
KV_SERIALIZE(unlock_time) KV_SERIALIZE(unlock_time)
KV_SERIALIZE(payment_id) KV_SERIALIZE(payment_id)
KV_SERIALIZE(get_tx_key) KV_SERIALIZE(get_tx_key)
@ -440,6 +442,7 @@ namespace wallet_rpc
std::set<uint32_t> subaddr_indices; std::set<uint32_t> subaddr_indices;
uint32_t priority; uint32_t priority;
uint64_t mixin; uint64_t mixin;
uint64_t ring_size;
uint64_t unlock_time; uint64_t unlock_time;
std::string payment_id; std::string payment_id;
bool get_tx_keys; bool get_tx_keys;
@ -453,6 +456,7 @@ namespace wallet_rpc
KV_SERIALIZE(subaddr_indices) KV_SERIALIZE(subaddr_indices)
KV_SERIALIZE(priority) KV_SERIALIZE(priority)
KV_SERIALIZE(mixin) KV_SERIALIZE(mixin)
KV_SERIALIZE_OPT(ring_size, (uint64_t)0)
KV_SERIALIZE(unlock_time) KV_SERIALIZE(unlock_time)
KV_SERIALIZE(payment_id) KV_SERIALIZE(payment_id)
KV_SERIALIZE(get_tx_keys) KV_SERIALIZE(get_tx_keys)
@ -550,6 +554,7 @@ namespace wallet_rpc
std::set<uint32_t> subaddr_indices; std::set<uint32_t> subaddr_indices;
uint32_t priority; uint32_t priority;
uint64_t mixin; uint64_t mixin;
uint64_t ring_size;
uint64_t unlock_time; uint64_t unlock_time;
std::string payment_id; std::string payment_id;
bool get_tx_keys; bool get_tx_keys;
@ -564,6 +569,7 @@ namespace wallet_rpc
KV_SERIALIZE(subaddr_indices) KV_SERIALIZE(subaddr_indices)
KV_SERIALIZE(priority) KV_SERIALIZE(priority)
KV_SERIALIZE(mixin) KV_SERIALIZE(mixin)
KV_SERIALIZE_OPT(ring_size, (uint64_t)0)
KV_SERIALIZE(unlock_time) KV_SERIALIZE(unlock_time)
KV_SERIALIZE(payment_id) KV_SERIALIZE(payment_id)
KV_SERIALIZE(get_tx_keys) KV_SERIALIZE(get_tx_keys)
@ -612,6 +618,7 @@ namespace wallet_rpc
std::string address; std::string address;
uint32_t priority; uint32_t priority;
uint64_t mixin; uint64_t mixin;
uint64_t ring_size;
uint64_t unlock_time; uint64_t unlock_time;
std::string payment_id; std::string payment_id;
bool get_tx_key; bool get_tx_key;
@ -624,6 +631,7 @@ namespace wallet_rpc
KV_SERIALIZE(address) KV_SERIALIZE(address)
KV_SERIALIZE(priority) KV_SERIALIZE(priority)
KV_SERIALIZE(mixin) KV_SERIALIZE(mixin)
KV_SERIALIZE_OPT(ring_size, (uint64_t)0)
KV_SERIALIZE(unlock_time) KV_SERIALIZE(unlock_time)
KV_SERIALIZE(payment_id) KV_SERIALIZE(payment_id)
KV_SERIALIZE(get_tx_key) KV_SERIALIZE(get_tx_key)