diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-10-10 10:33:17 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-11-14 13:12:39 +0000 |
commit | da8b60cbbf9573ffc4ade67737463562f047a790 (patch) | |
tree | f90ebc246f3aca8f97fccdb1f20b735b86c8586f /src/simplewallet/simplewallet.cpp | |
parent | Merge pull request #2685 (diff) | |
download | monero-da8b60cbbf9573ffc4ade67737463562f047a790.tar.xz |
simplewallet: reject attempts to use too low mixin early
This yields a clear error message rather then some possibly
confusing more technical errors down the line
Diffstat (limited to 'src/simplewallet/simplewallet.cpp')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 24e7d54dd..7a3d80058 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -2591,6 +2591,12 @@ bool simple_wallet::transfer_main(int transfer_type, const std::vector<std::stri local_args.erase(local_args.begin()); } } + uint64_t adjusted_fake_outs_count = m_wallet->adjust_mixin(fake_outs_count); + if (adjusted_fake_outs_count > fake_outs_count) + { + fail_msg_writer() << (boost::format(tr("ring size %u is too small, minimum is %u")) % (fake_outs_count+1) % (adjusted_fake_outs_count+1)).str(); + return true; + } const size_t min_args = (transfer_type == TransferLocked) ? 3 : 2; if(local_args.size() < min_args) @@ -3196,6 +3202,12 @@ bool simple_wallet::sweep_main(uint64_t below, const std::vector<std::string> &a local_args.erase(local_args.begin()); } } + uint64_t adjusted_fake_outs_count = m_wallet->adjust_mixin(fake_outs_count); + if (adjusted_fake_outs_count > fake_outs_count) + { + fail_msg_writer() << (boost::format(tr("ring size %u is too small, minimum is %u")) % (fake_outs_count+1) % (adjusted_fake_outs_count+1)).str(); + return true; + } std::vector<uint8_t> extra; bool payment_id_seen = false; |