aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-08-15 20:55:30 +0200
committerRiccardo Spagni <ric@spagni.net>2017-08-15 20:55:30 +0200
commit9e6bcbc0144c97c1acb11e7f3ee8d66691289d32 (patch)
tree5034a2b6c56e42002767c463a37cf1de83133ea1 /src/wallet
parentMerge pull request #2285 (diff)
parentwallet_rpc_server: adjust small ring sizes to 5 for v6 (diff)
downloadmonero-9e6bcbc0144c97c1acb11e7f3ee8d66691289d32.tar.xz
Merge pull request #2286
8655ba04 wallet_rpc_server: adjust small ring sizes to 5 for v6 (moneromooo-monero)
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet_rpc_server.cpp28
-rw-r--r--src/wallet/wallet_rpc_server.h1
2 files changed, 18 insertions, 11 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index 77911e9a7..773d12775 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -227,6 +227,19 @@ namespace tools
return false;
}
//------------------------------------------------------------------------------------------------------------------------------
+ uint64_t wallet_rpc_server::adjust_mixin(uint64_t mixin)
+ {
+ if (mixin < 4 && m_wallet->use_fork_rules(6, 10)) {
+ MWARNING("Requested ring size " << (mixin + 1) << " too low for hard fork 6, using 5");
+ mixin = 4;
+ }
+ else if (mixin < 2 && m_wallet->use_fork_rules(2, 10)) {
+ MWARNING("Requested ring size " << (mixin + 1) << " too low for hard fork 2, using 3");
+ mixin = 2;
+ }
+ return mixin;
+ }
+ //------------------------------------------------------------------------------------------------------------------------------
void wallet_rpc_server::fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const crypto::hash &payment_id, const tools::wallet2::payment_details &pd)
{
entry.txid = string_tools::pod_to_hex(pd.m_tx_hash);
@@ -458,11 +471,7 @@ namespace tools
try
{
- uint64_t mixin = req.mixin;
- if (mixin < 2 && m_wallet->use_fork_rules(2, 10)) {
- LOG_PRINT_L1("Requested ring size " << (req.mixin + 1) << " too low for hard fork 2, using 3");
- mixin = 2;
- }
+ uint64_t mixin = adjust_mixin(req.mixin);
std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_2(dsts, mixin, req.unlock_time, req.priority, extra, m_trusted_daemon);
// reject proposed transactions if there are more than one. see on_transfer_split below.
@@ -535,12 +544,8 @@ namespace tools
try
{
- uint64_t mixin = req.mixin;
+ uint64_t mixin = adjust_mixin(req.mixin);
uint64_t ptx_amount;
- if (mixin < 2 && m_wallet->use_fork_rules(2, 10)) {
- LOG_PRINT_L1("Requested ring size " << (req.mixin + 1) << " too low for hard fork 2, using 3");
- mixin = 2;
- }
std::vector<wallet2::pending_tx> ptx_vector;
LOG_PRINT_L2("on_transfer_split calling create_transactions_2");
ptx_vector = m_wallet->create_transactions_2(dsts, mixin, req.unlock_time, req.priority, extra, m_trusted_daemon);
@@ -682,7 +687,8 @@ namespace tools
try
{
- std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_all(req.below_amount, dsts[0].addr, req.mixin, req.unlock_time, req.priority, extra, m_trusted_daemon);
+ uint64_t mixin = adjust_mixin(req.mixin);
+ std::vector<wallet2::pending_tx> ptx_vector = m_wallet->create_transactions_all(req.below_amount, dsts[0].addr, mixin, req.unlock_time, req.priority, extra, m_trusted_daemon);
if (!req.do_not_relay)
m_wallet->commit_tx(ptx_vector);
diff --git a/src/wallet/wallet_rpc_server.h b/src/wallet/wallet_rpc_server.h
index 68e4c049a..dd54222b0 100644
--- a/src/wallet/wallet_rpc_server.h
+++ b/src/wallet/wallet_rpc_server.h
@@ -150,6 +150,7 @@ namespace tools
void fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const tools::wallet2::unconfirmed_transfer_details &pd);
void fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &payment_id, const tools::wallet2::payment_details &pd);
bool not_open(epee::json_rpc::error& er);
+ uint64_t adjust_mixin(uint64_t mixin);
wallet2 *m_wallet;
std::string m_wallet_dir;