diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-03-18 15:57:58 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-03-18 15:57:58 +0200 |
commit | b8ccd47b9fbf877d506ea6619a95b6376ae47f40 (patch) | |
tree | df7d4e13d5bc46a8ee8f5b212ff66cd1b3169ce5 /src/simplewallet | |
parent | Merge pull request #3424 (diff) | |
parent | wallet: make the segregation height settable (diff) | |
download | monero-b8ccd47b9fbf877d506ea6619a95b6376ae47f40.tar.xz |
Merge pull request #3419
1e393f4b wallet: make the segregation height settable (moneromooo-monero)
Diffstat (limited to 'src/simplewallet')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 24 | ||||
-rw-r--r-- | src/simplewallet/simplewallet.h | 1 |
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); |