From 1e393f4bb779cc5e108705109bc62362b8d243d5 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 13 Mar 2018 19:38:52 +0000 Subject: wallet: make the segregation height settable via user setting first, then DNS TXT record, hardcoded fallback --- src/simplewallet/simplewallet.cpp | 24 +++++++++++++++++++++++- src/simplewallet/simplewallet.h | 1 + 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'src/simplewallet') 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 &arg return true; } +bool simple_wallet::set_segregation_height(const std::vector &args/* = std::vector()*/) +{ + 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 &args/* = std::vector()*/) { 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 :\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 " + " 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 &args) success_msg_writer() << "key-reuse-mitigation2 = " << m_wallet->key_reuse_mitigation2(); const std::pair 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 &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(":")); + 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 &args = std::vector()); bool set_key_reuse_mitigation2(const std::vector &args = std::vector()); bool set_subaddress_lookahead(const std::vector &args = std::vector()); + bool set_segregation_height(const std::vector &args = std::vector()); bool help(const std::vector &args = std::vector()); bool start_mining(const std::vector &args); bool stop_mining(const std::vector &args); -- cgit v1.2.3