diff options
author | luigi1111 <luigi1111w@gmail.com> | 2019-10-16 13:40:44 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2019-10-16 13:40:44 -0500 |
commit | 40e71742a019e64d0ca10c2abed52e440dcd20a1 (patch) | |
tree | 4422f7ad82c0a9cf9b814c035be06f82e9f4e4e1 /src/simplewallet | |
parent | Merge pull request #5946 (diff) | |
parent | wallet2: add ignore-outputs-{above/below} option (diff) | |
download | monero-40e71742a019e64d0ca10c2abed52e440dcd20a1.tar.xz |
Merge pull request #5952
93d5cf2 wallet2: add ignore-outputs-{above/below} option (stoffu)
Diffstat (limited to 'src/simplewallet')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 45 | ||||
-rw-r--r-- | src/simplewallet/simplewallet.h | 2 |
2 files changed, 47 insertions, 0 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 4484aa84e..0174104be 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -2659,6 +2659,43 @@ bool simple_wallet::set_ignore_fractional_outputs(const std::vector<std::string> return true; } + +bool simple_wallet::set_ignore_outputs_above(const std::vector<std::string> &args/* = std::vector<std::string>()*/) +{ + const auto pwd_container = get_and_verify_password(); + if (pwd_container) + { + uint64_t amount; + if (!cryptonote::parse_amount(amount, args[1])) + { + fail_msg_writer() << tr("Invalid amount"); + return true; + } + if (amount == 0) + amount = MONEY_SUPPLY; + m_wallet->ignore_outputs_above(amount); + m_wallet->rewrite(m_wallet_file, pwd_container->password()); + } + return true; +} + +bool simple_wallet::set_ignore_outputs_below(const std::vector<std::string> &args/* = std::vector<std::string>()*/) +{ + const auto pwd_container = get_and_verify_password(); + if (pwd_container) + { + uint64_t amount; + if (!cryptonote::parse_amount(amount, args[1])) + { + fail_msg_writer() << tr("Invalid amount"); + return true; + } + m_wallet->ignore_outputs_below(amount); + m_wallet->rewrite(m_wallet_file, pwd_container->password()); + } + return true; +} + bool simple_wallet::set_track_uses(const std::vector<std::string> &args/* = std::vector<std::string>()*/) { const auto pwd_container = get_and_verify_password(); @@ -2973,6 +3010,10 @@ simple_wallet::simple_wallet() " Set to the height of a key reusing fork you want to use, 0 to use default.\n " "ignore-fractional-outputs <1|0>\n " " Whether to ignore fractional outputs that result in net loss when spending due to fee.\n " + "ignore-outputs-above <amount>\n " + " Ignore outputs of amount above this threshold when spending. Value 0 is translated to the maximum value (18 million) which disables this filter.\n " + "ignore-outputs-below <amount>\n " + " Ignore outputs of amount below this threshold when spending.\n " "track-uses <1|0>\n " " Whether to keep track of owned outputs uses.\n " "setup-background-mining <1|0>\n " @@ -3349,6 +3390,8 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args) success_msg_writer() << "subaddress-lookahead = " << lookahead.first << ":" << lookahead.second; success_msg_writer() << "segregation-height = " << m_wallet->segregation_height(); success_msg_writer() << "ignore-fractional-outputs = " << m_wallet->ignore_fractional_outputs(); + success_msg_writer() << "ignore-outputs-above = " << cryptonote::print_money(m_wallet->ignore_outputs_above()); + success_msg_writer() << "ignore-outputs-below = " << cryptonote::print_money(m_wallet->ignore_outputs_below()); success_msg_writer() << "track-uses = " << m_wallet->track_uses(); success_msg_writer() << "setup-background-mining = " << setup_background_mining_string; success_msg_writer() << "device-name = " << m_wallet->device_name(); @@ -3412,6 +3455,8 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args) CHECK_SIMPLE_VARIABLE("subaddress-lookahead", set_subaddress_lookahead, tr("<major>:<minor>")); CHECK_SIMPLE_VARIABLE("segregation-height", set_segregation_height, tr("unsigned integer")); CHECK_SIMPLE_VARIABLE("ignore-fractional-outputs", set_ignore_fractional_outputs, tr("0 or 1")); + CHECK_SIMPLE_VARIABLE("ignore-outputs-above", set_ignore_outputs_above, tr("amount")); + CHECK_SIMPLE_VARIABLE("ignore-outputs-below", set_ignore_outputs_below, tr("amount")); CHECK_SIMPLE_VARIABLE("track-uses", set_track_uses, tr("0 or 1")); CHECK_SIMPLE_VARIABLE("inactivity-lock-timeout", set_inactivity_lock_timeout, tr("unsigned integer (seconds, 0 to disable)")); CHECK_SIMPLE_VARIABLE("setup-background-mining", set_setup_background_mining, tr("1/yes or 0/no")); diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h index bd135a9c1..47e08ca87 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -144,6 +144,8 @@ namespace cryptonote bool set_subaddress_lookahead(const std::vector<std::string> &args = std::vector<std::string>()); bool set_segregation_height(const std::vector<std::string> &args = std::vector<std::string>()); bool set_ignore_fractional_outputs(const std::vector<std::string> &args = std::vector<std::string>()); + bool set_ignore_outputs_above(const std::vector<std::string> &args = std::vector<std::string>()); + bool set_ignore_outputs_below(const std::vector<std::string> &args = std::vector<std::string>()); bool set_track_uses(const std::vector<std::string> &args = std::vector<std::string>()); bool set_inactivity_lock_timeout(const std::vector<std::string> &args = std::vector<std::string>()); bool set_setup_background_mining(const std::vector<std::string> &args = std::vector<std::string>()); |