aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet/simplewallet.cpp
diff options
context:
space:
mode:
authorxiphon <xiphon@protonmail.com>2020-10-12 21:13:58 +0000
committerxiphon <xiphon@protonmail.com>2020-10-13 15:23:35 +0000
commitec14e4b8cd5b78c8d3251bb205294810b29f880e (patch)
tree5b9d861c12a4af68c502299f314184a3e8ba3210 /src/simplewallet/simplewallet.cpp
parentMerge pull request #6819 (diff)
downloadmonero-ec14e4b8cd5b78c8d3251bb205294810b29f880e.tar.xz
wallet2: skip reorgs exceeding max-reorg-depth wallet setting
Diffstat (limited to 'src/simplewallet/simplewallet.cpp')
-rw-r--r--src/simplewallet/simplewallet.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 7b26d21fb..a90bd3a39 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -2705,6 +2705,24 @@ bool simple_wallet::set_unit(const std::vector<std::string> &args/* = std::vecto
return true;
}
+bool simple_wallet::set_max_reorg_depth(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
+{
+ uint64_t depth;
+ if (!epee::string_tools::get_xtype_from_string(depth, args[1]))
+ {
+ fail_msg_writer() << tr("invalid value");
+ return true;
+ }
+
+ const auto pwd_container = get_and_verify_password();
+ if (pwd_container)
+ {
+ m_wallet->max_reorg_depth(depth);
+ m_wallet->rewrite(m_wallet_file, pwd_container->password());
+ }
+ return true;
+}
+
bool simple_wallet::set_min_output_count(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
{
uint32_t count;
@@ -3783,6 +3801,7 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
success_msg_writer() << "priority = " << priority<< " (" << priority_string << ")";
success_msg_writer() << "ask-password = " << m_wallet->ask_password() << " (" << ask_password_string << ")";
success_msg_writer() << "unit = " << cryptonote::get_unit(cryptonote::get_default_decimal_point());
+ success_msg_writer() << "max-reorg-depth = " << m_wallet->max_reorg_depth();
success_msg_writer() << "min-outputs-count = " << m_wallet->get_min_output_count();
success_msg_writer() << "min-outputs-value = " << cryptonote::print_money(m_wallet->get_min_output_value());
success_msg_writer() << "merge-destinations = " << m_wallet->merge_destinations();
@@ -3853,6 +3872,7 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
CHECK_SIMPLE_VARIABLE("priority", set_default_priority, tr("0, 1, 2, 3, or 4, or one of ") << join_priority_strings(", "));
CHECK_SIMPLE_VARIABLE("ask-password", set_ask_password, tr("0|1|2 (or never|action|decrypt)"));
CHECK_SIMPLE_VARIABLE("unit", set_unit, tr("monero, millinero, micronero, nanonero, piconero"));
+ CHECK_SIMPLE_VARIABLE("max-reorg-depth", set_max_reorg_depth, tr("unsigned integer"));
CHECK_SIMPLE_VARIABLE("min-outputs-count", set_min_output_count, tr("unsigned integer"));
CHECK_SIMPLE_VARIABLE("min-outputs-value", set_min_output_value, tr("amount"));
CHECK_SIMPLE_VARIABLE("merge-destinations", set_merge_destinations, tr("0 or 1"));