aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-03-13 19:38:52 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-03-17 14:56:31 +0000
commit1e393f4bb779cc5e108705109bc62362b8d243d5 (patch)
treec0d0af436ce3bb51a17311d4aede4a49d5b3bf74 /src/simplewallet
parentMerge pull request #3421 (diff)
downloadmonero-1e393f4bb779cc5e108705109bc62362b8d243d5.tar.xz
wallet: make the segregation height settable
via user setting first, then DNS TXT record, hardcoded fallback
Diffstat (limited to 'src/simplewallet')
-rw-r--r--src/simplewallet/simplewallet.cpp24
-rw-r--r--src/simplewallet/simplewallet.h1
2 files changed, 24 insertions, 1 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 54132d9ca..b5a568a14 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -1968,6 +1968,23 @@ bool simple_wallet::set_subaddress_lookahead(const std::vector<std::string> &arg
return true;
}
+bool simple_wallet::set_segregation_height(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
+{
+ const auto pwd_container = get_and_verify_password();
+ if (pwd_container)
+ {
+ uint64_t height;
+ if (!epee::string_tools::get_xtype_from_string(height, args[1]))
+ {
+ fail_msg_writer() << tr("Invalid height");
+ return true;
+ }
+ m_wallet->segregation_height(height);
+ m_wallet->rewrite(m_wallet_file, pwd_container->password());
+ }
+ return true;
+}
+
bool simple_wallet::help(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
{
if(args.empty())
@@ -2148,7 +2165,10 @@ simple_wallet::simple_wallet()
"key-reuse-mitigation2 <1|0>\n "
" Set this if you are not sure whether you will spend on a key reusing Monero fork later.\n"
"subaddress-lookahead <major>:<minor>\n "
- " Set the lookahead sizes for the subaddress hash table."));
+ " Set the lookahead sizes for the subaddress hash table.\n "
+ " Set this if you are not sure whether you will spend on a key reusing Monero fork later.\n "
+ "segregation-height <n>\n "
+ " Set to the height of a key reusing fork you want to use, 0 to use default."));
m_cmd_binder.set_handler("encrypted_seed",
boost::bind(&simple_wallet::encrypted_seed, this, _1),
tr("Display the encrypted Electrum-style mnemonic seed."));
@@ -2344,6 +2364,7 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
success_msg_writer() << "key-reuse-mitigation2 = " << m_wallet->key_reuse_mitigation2();
const std::pair<size_t, size_t> lookahead = m_wallet->get_subaddress_lookahead();
success_msg_writer() << "subaddress-lookahead = " << lookahead.first << ":" << lookahead.second;
+ success_msg_writer() << "segregation-height = " << m_wallet->segregation_height();
return true;
}
else
@@ -2397,6 +2418,7 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
CHECK_SIMPLE_VARIABLE("segregate-pre-fork-outputs", set_segregate_pre_fork_outputs, tr("0 or 1"));
CHECK_SIMPLE_VARIABLE("key-reuse-mitigation2", set_key_reuse_mitigation2, tr("0 or 1"));
CHECK_SIMPLE_VARIABLE("subaddress-lookahead", set_subaddress_lookahead, tr("<major>:<minor>"));
+ CHECK_SIMPLE_VARIABLE("segregation-height", set_segregation_height, tr("unsigned integer"));
}
fail_msg_writer() << tr("set: unrecognized argument(s)");
return true;
diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h
index b2630c75e..f45018b60 100644
--- a/src/simplewallet/simplewallet.h
+++ b/src/simplewallet/simplewallet.h
@@ -136,6 +136,7 @@ namespace cryptonote
bool set_segregate_pre_fork_outputs(const std::vector<std::string> &args = std::vector<std::string>());
bool set_key_reuse_mitigation2(const std::vector<std::string> &args = std::vector<std::string>());
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 help(const std::vector<std::string> &args = std::vector<std::string>());
bool start_mining(const std::vector<std::string> &args);
bool stop_mining(const std::vector<std::string> &args);