aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet/simplewallet.cpp
diff options
context:
space:
mode:
authorAlexander Blair <snipa@jagtech.io>2020-12-01 14:18:21 -0800
committerAlexander Blair <snipa@jagtech.io>2020-12-01 14:18:22 -0800
commit438442ace07d72a9c52c887a02335ea795fbd075 (patch)
treed6cfe9edd505da2bf1b2a9232bfe6655dea73062 /src/simplewallet/simplewallet.cpp
parent850edfe4199458314346e2910550b33663310f42 (diff)
parentec14e4b8cd5b78c8d3251bb205294810b29f880e (diff)
downloadmonzero-core-438442ace07d72a9c52c887a02335ea795fbd075.tar.gz
monzero-core-438442ace07d72a9c52c887a02335ea795fbd075.tar.xz
monzero-core-438442ace07d72a9c52c887a02335ea795fbd075.zip
Merge pull request #6890
ec14e4b8c wallet2: skip reorgs exceeding max-reorg-depth wallet setting (xiphon)
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"));