aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--src/cryptonote_core/blockchain.cpp7
-rw-r--r--src/mnemonics/chinese_simplified.h2
-rw-r--r--src/mnemonics/dutch.h2
-rw-r--r--src/mnemonics/electrum-words.cpp34
-rw-r--r--src/mnemonics/electrum-words.h10
-rw-r--r--src/mnemonics/english.h2
-rw-r--r--src/mnemonics/english_old.h2
-rw-r--r--src/mnemonics/esperanto.h2
-rw-r--r--src/mnemonics/french.h2
-rw-r--r--src/mnemonics/german.h2
-rw-r--r--src/mnemonics/italian.h2
-rw-r--r--src/mnemonics/japanese.h2
-rw-r--r--src/mnemonics/language_base.h14
-rw-r--r--src/mnemonics/lojban.h2
-rw-r--r--src/mnemonics/portuguese.h2
-rw-r--r--src/mnemonics/russian.h2
-rw-r--r--src/mnemonics/spanish.h2
-rw-r--r--src/simplewallet/simplewallet.cpp115
-rw-r--r--src/simplewallet/simplewallet.h4
-rw-r--r--src/wallet/wallet2.cpp66
-rw-r--r--src/wallet/wallet2.h6
-rw-r--r--src/wallet/wallet_rpc_server.h1
23 files changed, 246 insertions, 39 deletions
diff --git a/README.md b/README.md
index ac3b19acb..114afcd4e 100644
--- a/README.md
+++ b/README.md
@@ -99,7 +99,7 @@ Dates are provided in the format YYYY-MM-DD.
| 1220516 | 2017-01-05 | v4 | v0.10.1 | v0.10.2.1 | Allow normal and RingCT transactions |
| 1288616 | 2017-04-15 | v5 | v0.10.3.0 | v0.10.3.1 | Adjusted minimum blocksize and fee algorithm |
| 1400000 | 2017-09-16 | v6 | v0.11.0.0 | v0.11.0.0 | Allow only RingCT transactions, allow only >= ringsize 5 |
-| 1539500 | 2018-03-28 | v7 | XXXXXXXXX | XXXXXXXXX | Cryptonight variant 1, ringsize >= 7, sorted inputs
+| 1546000 | 2018-04-06 | v7 | v0.12.0.0 | v0.12.0.0 | Cryptonight variant 1, ringsize >= 7, sorted inputs
X's indicate that these details have not been determined as of commit date.
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index bc3575aa1..3db516847 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -107,8 +107,8 @@ static const struct {
// version 6 starts from block 1400000, which is on or around the 16th of September, 2017. Fork time finalised on 2017-08-18.
{ 6, 1400000, 0, 1503046577 },
- // version 7 starts from block 1539500, which is on or around the 28th of March, 2018. Fork time finalised on 2018-03-07.
- { 7, 1539500, 0, 1520436050 },
+ // version 7 starts from block 1546000, which is on or around the 6th of April, 2018. Fork time finalised on 2018-03-17.
+ { 7, 1546000, 0, 1521303150 },
};
static const uint64_t mainnet_hard_fork_version_1_till = 1009826;
@@ -2446,7 +2446,8 @@ bool Blockchain::check_tx_outputs(const transaction& tx, tx_verification_context
// from v8, allow bulletproofs
if (hf_version < 8) {
- if (!tx.rct_signatures.p.bulletproofs.empty())
+ const bool bulletproof = tx.rct_signatures.type == rct::RCTTypeFullBulletproof || tx.rct_signatures.type == rct::RCTTypeSimpleBulletproof;
+ if (bulletproof || !tx.rct_signatures.p.bulletproofs.empty())
{
MERROR("Bulletproofs are not allowed before v8");
tvc.m_invalid_output = true;
diff --git a/src/mnemonics/chinese_simplified.h b/src/mnemonics/chinese_simplified.h
index dd5548ba2..1ae8c89d6 100644
--- a/src/mnemonics/chinese_simplified.h
+++ b/src/mnemonics/chinese_simplified.h
@@ -72,7 +72,7 @@ namespace Language
class Chinese_Simplified: public Base
{
public:
- Chinese_Simplified(): Base("简体中文 (中国)", std::vector<std::string>({
+ Chinese_Simplified(): Base("简体中文 (中国)", "Chinese (simplified)", std::vector<std::string>({
"的",
"一",
"是",
diff --git a/src/mnemonics/dutch.h b/src/mnemonics/dutch.h
index 43185cd1d..c9806f450 100644
--- a/src/mnemonics/dutch.h
+++ b/src/mnemonics/dutch.h
@@ -49,7 +49,7 @@ namespace Language
class Dutch: public Base
{
public:
- Dutch(): Base("Nederlands", std::vector<std::string>({
+ Dutch(): Base("Nederlands", "Dutch", std::vector<std::string>({
"aalglad",
"aalscholver",
"aambeeld",
diff --git a/src/mnemonics/electrum-words.cpp b/src/mnemonics/electrum-words.cpp
index f1fef2426..6a2a3e0c4 100644
--- a/src/mnemonics/electrum-words.cpp
+++ b/src/mnemonics/electrum-words.cpp
@@ -445,13 +445,9 @@ namespace crypto
return bytes_to_words(src.data, sizeof(src), words, language_name);
}
- /*!
- * \brief Gets a list of seed languages that are supported.
- * \param languages The vector is set to the list of languages.
- */
- void get_language_list(std::vector<std::string> &languages)
+ std::vector<const Language::Base*> get_language_list()
{
- std::vector<Language::Base*> language_instances({
+ static const std::vector<const Language::Base*> language_instances({
Language::Singleton<Language::German>::instance(),
Language::Singleton<Language::English>::instance(),
Language::Singleton<Language::Spanish>::instance(),
@@ -465,10 +461,20 @@ namespace crypto
Language::Singleton<Language::Esperanto>::instance(),
Language::Singleton<Language::Lojban>::instance()
});
- for (std::vector<Language::Base*>::iterator it = language_instances.begin();
+ return language_instances;
+ }
+
+ /*!
+ * \brief Gets a list of seed languages that are supported.
+ * \param languages The vector is set to the list of languages.
+ */
+ void get_language_list(std::vector<std::string> &languages, bool english)
+ {
+ const std::vector<const Language::Base*> language_instances = get_language_list();
+ for (std::vector<const Language::Base*>::const_iterator it = language_instances.begin();
it != language_instances.end(); it++)
{
- languages.push_back((*it)->get_language_name());
+ languages.push_back(english ? (*it)->get_english_language_name() : (*it)->get_language_name());
}
}
@@ -485,6 +491,18 @@ namespace crypto
return word_list.size() != (seed_length + 1);
}
+ std::string get_english_name_for(const std::string &name)
+ {
+ const std::vector<const Language::Base*> language_instances = get_language_list();
+ for (std::vector<const Language::Base*>::const_iterator it = language_instances.begin();
+ it != language_instances.end(); it++)
+ {
+ if ((*it)->get_language_name() == name)
+ return (*it)->get_english_language_name();
+ }
+ return "<language not found>";
+ }
+
}
}
diff --git a/src/mnemonics/electrum-words.h b/src/mnemonics/electrum-words.h
index 48ee378c0..856edb92a 100644
--- a/src/mnemonics/electrum-words.h
+++ b/src/mnemonics/electrum-words.h
@@ -106,8 +106,9 @@ namespace crypto
/*!
* \brief Gets a list of seed languages that are supported.
* \param languages A vector is set to the list of languages.
+ * \param english whether to get the names in English or the language language
*/
- void get_language_list(std::vector<std::string> &languages);
+ void get_language_list(std::vector<std::string> &languages, bool english = false);
/*!
* \brief Tells if the seed passed is an old style seed or not.
@@ -115,6 +116,13 @@ namespace crypto
* \return true if the seed passed is a old style seed false if not.
*/
bool get_is_old_style_seed(std::string seed);
+
+ /*!
+ * \brief Returns the name of a language in English
+ * \param name the name of the language in its own language
+ * \return the name of the language in English
+ */
+ std::string get_english_name_for(const std::string &name);
}
}
diff --git a/src/mnemonics/english.h b/src/mnemonics/english.h
index d4a89ebbc..ee087674d 100644
--- a/src/mnemonics/english.h
+++ b/src/mnemonics/english.h
@@ -49,7 +49,7 @@ namespace Language
class English: public Base
{
public:
- English(): Base("English", std::vector<std::string>({
+ English(): Base("English", "English", std::vector<std::string>({
"abbey",
"abducts",
"ability",
diff --git a/src/mnemonics/english_old.h b/src/mnemonics/english_old.h
index 8866c8d71..b31491646 100644
--- a/src/mnemonics/english_old.h
+++ b/src/mnemonics/english_old.h
@@ -51,7 +51,7 @@ namespace Language
class EnglishOld: public Base
{
public:
- EnglishOld(): Base("EnglishOld", std::vector<std::string>({
+ EnglishOld(): Base("EnglishOld", "English (old)", std::vector<std::string>({
"like",
"just",
"love",
diff --git a/src/mnemonics/esperanto.h b/src/mnemonics/esperanto.h
index 21ee4c9f1..cb377a58e 100644
--- a/src/mnemonics/esperanto.h
+++ b/src/mnemonics/esperanto.h
@@ -58,7 +58,7 @@ namespace Language
class Esperanto: public Base
{
public:
- Esperanto(): Base("Esperanto", std::vector<std::string>({
+ Esperanto(): Base("Esperanto", "Esperanto", std::vector<std::string>({
"abako",
"abdiki",
"abelo",
diff --git a/src/mnemonics/french.h b/src/mnemonics/french.h
index a472263b3..7eaf45650 100644
--- a/src/mnemonics/french.h
+++ b/src/mnemonics/french.h
@@ -49,7 +49,7 @@ namespace Language
class French: public Base
{
public:
- French(): Base("Français", std::vector<std::string>({
+ French(): Base("Français", "French", std::vector<std::string>({
"abandon",
"abattre",
"aboi",
diff --git a/src/mnemonics/german.h b/src/mnemonics/german.h
index 01c483664..8eff43523 100644
--- a/src/mnemonics/german.h
+++ b/src/mnemonics/german.h
@@ -51,7 +51,7 @@ namespace Language
class German: public Base
{
public:
- German(): Base("Deutsch", std::vector<std::string>({
+ German(): Base("Deutsch", "German", std::vector<std::string>({
"Abakus",
"Abart",
"abbilden",
diff --git a/src/mnemonics/italian.h b/src/mnemonics/italian.h
index f9536e2dd..d5ecb74f4 100644
--- a/src/mnemonics/italian.h
+++ b/src/mnemonics/italian.h
@@ -51,7 +51,7 @@ namespace Language
class Italian: public Base
{
public:
- Italian(): Base("Italiano", std::vector<std::string>({
+ Italian(): Base("Italiano", "Italian", std::vector<std::string>({
"abbinare",
"abbonato",
"abisso",
diff --git a/src/mnemonics/japanese.h b/src/mnemonics/japanese.h
index 5b5884c3b..f3b3e4924 100644
--- a/src/mnemonics/japanese.h
+++ b/src/mnemonics/japanese.h
@@ -71,7 +71,7 @@ namespace Language
class Japanese: public Base
{
public:
- Japanese(): Base("日本語", std::vector<std::string>({
+ Japanese(): Base("日本語", "Japanese", std::vector<std::string>({
"あいこくしん",
"あいさつ",
"あいだ",
diff --git a/src/mnemonics/language_base.h b/src/mnemonics/language_base.h
index 2124b8ea4..2b0c37c6b 100644
--- a/src/mnemonics/language_base.h
+++ b/src/mnemonics/language_base.h
@@ -82,6 +82,7 @@ namespace Language
std::unordered_map<std::string, uint32_t> word_map; /*!< hash table to find word's index */
std::unordered_map<std::string, uint32_t> trimmed_word_map; /*!< hash table to find word's trimmed index */
std::string language_name; /*!< Name of language */
+ std::string english_language_name; /*!< Name of language */
uint32_t unique_prefix_length; /*!< Number of unique starting characters to trim the wordlist to when matching */
/*!
* \brief Populates the word maps after the list is ready.
@@ -122,10 +123,11 @@ namespace Language
}
}
public:
- Base(const char *language_name, const std::vector<std::string> &words, uint32_t prefix_length):
+ Base(const char *language_name, const char *english_language_name, const std::vector<std::string> &words, uint32_t prefix_length):
word_list(words),
unique_prefix_length(prefix_length),
- language_name(language_name)
+ language_name(language_name),
+ english_language_name(english_language_name)
{
}
virtual ~Base()
@@ -164,6 +166,14 @@ namespace Language
return language_name;
}
/*!
+ * \brief Returns the name of the language in English.
+ * \return Name of the language.
+ */
+ const std::string &get_english_language_name() const
+ {
+ return english_language_name;
+ }
+ /*!
* \brief Returns the number of unique starting characters to be used for matching.
* \return Number of unique starting characters.
*/
diff --git a/src/mnemonics/lojban.h b/src/mnemonics/lojban.h
index 723f1eac0..412531a23 100644
--- a/src/mnemonics/lojban.h
+++ b/src/mnemonics/lojban.h
@@ -56,7 +56,7 @@ namespace Language
class Lojban: public Base
{
public:
- Lojban(): Base("Lojban", std::vector<std::string>({
+ Lojban(): Base("Lojban", "Lojban", std::vector<std::string>({
"backi",
"bacru",
"badna",
diff --git a/src/mnemonics/portuguese.h b/src/mnemonics/portuguese.h
index f68716962..0195389ce 100644
--- a/src/mnemonics/portuguese.h
+++ b/src/mnemonics/portuguese.h
@@ -72,7 +72,7 @@ namespace Language
class Portuguese: public Base
{
public:
- Portuguese(): Base("Português", std::vector<std::string>({
+ Portuguese(): Base("Português", "Portuguese", std::vector<std::string>({
"abaular",
"abdominal",
"abeto",
diff --git a/src/mnemonics/russian.h b/src/mnemonics/russian.h
index 749191c9b..d5dd556ef 100644
--- a/src/mnemonics/russian.h
+++ b/src/mnemonics/russian.h
@@ -51,7 +51,7 @@ namespace Language
class Russian: public Base
{
public:
- Russian(): Base("русский язык", std::vector<std::string>({
+ Russian(): Base("русский язык", "Russian", std::vector<std::string>({
"абажур",
"абзац",
"абонент",
diff --git a/src/mnemonics/spanish.h b/src/mnemonics/spanish.h
index 0c581128e..51f38fede 100644
--- a/src/mnemonics/spanish.h
+++ b/src/mnemonics/spanish.h
@@ -72,7 +72,7 @@ namespace Language
class Spanish: public Base
{
public:
- Spanish(): Base("Español", std::vector<std::string>({
+ Spanish(): Base("Español", "Spanish", std::vector<std::string>({
"ábaco",
"abdomen",
"abeja",
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 747c91d16..97dadb126 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -134,6 +134,8 @@ namespace
const command_line::arg_descriptor<uint64_t> arg_restore_height = {"restore-height", sw::tr("Restore from specific blockchain height"), 0};
const command_line::arg_descriptor<bool> arg_do_not_relay = {"do-not-relay", sw::tr("The newly created transaction will not be relayed to the monero network"), false};
const command_line::arg_descriptor<bool> arg_create_address_file = {"create-address-file", sw::tr("Create an address file for new wallets"), false};
+ const command_line::arg_descriptor<std::string> arg_subaddress_lookahead = {"subaddress-lookahead", tools::wallet2::tr("Set subaddress lookahead sizes to <major>:<minor>"), ""};
+ const command_line::arg_descriptor<bool> arg_use_english_language_names = {"use-english-language-names", sw::tr("Display English language names"), false};
const command_line::arg_descriptor< std::vector<std::string> > arg_command = {"command", ""};
@@ -375,6 +377,25 @@ namespace
return true;
}
+ boost::optional<std::pair<uint32_t, uint32_t>> parse_subaddress_lookahead(const std::string& str)
+ {
+ auto pos = str.find(":");
+ bool r = pos != std::string::npos;
+ uint32_t major;
+ r = r && epee::string_tools::get_xtype_from_string(major, str.substr(0, pos));
+ uint32_t minor;
+ r = r && epee::string_tools::get_xtype_from_string(minor, str.substr(pos + 1));
+ if (r)
+ {
+ return std::make_pair(major, minor);
+ }
+ else
+ {
+ fail_msg_writer() << tr("invalid format for subaddress lookahead; must be <major>:<minor>");
+ return {};
+ }
+ }
+
void handle_transfer_exception(const std::exception_ptr &e, bool trusted_daemon)
{
bool warn_of_possible_attack = !trusted_daemon;
@@ -1933,6 +1954,38 @@ bool simple_wallet::set_key_reuse_mitigation2(const std::vector<std::string> &ar
return true;
}
+bool simple_wallet::set_subaddress_lookahead(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
+{
+ const auto pwd_container = get_and_verify_password();
+ if (pwd_container)
+ {
+ auto lookahead = parse_subaddress_lookahead(args[1]);
+ if (lookahead)
+ {
+ m_wallet->set_subaddress_lookahead(lookahead->first, lookahead->second);
+ m_wallet->rewrite(m_wallet_file, pwd_container->password());
+ }
+ }
+ 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())
@@ -2111,7 +2164,12 @@ simple_wallet::simple_wallet()
"segregate-pre-fork-outputs <1|0>\n "
" Set this if you intend to spend outputs on both Monero AND a key reusing fork.\n "
"key-reuse-mitigation2 <1|0>\n "
- " Set this if you are not sure whether you will spend on a key reusing Monero fork later."));
+ " 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.\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."));
@@ -2284,7 +2342,10 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
{
if (args.empty())
{
- success_msg_writer() << "seed = " << m_wallet->get_seed_language();
+ std::string seed_language = m_wallet->get_seed_language();
+ if (m_use_english_language_names)
+ seed_language = crypto::ElectrumWords::get_english_name_for(seed_language);
+ success_msg_writer() << "seed = " << seed_language;
success_msg_writer() << "always-confirm-transfers = " << m_wallet->always_confirm_transfers();
success_msg_writer() << "print-ring-members = " << m_wallet->print_ring_members();
success_msg_writer() << "store-tx-info = " << m_wallet->store_tx_info();
@@ -2305,6 +2366,9 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
success_msg_writer() << "auto-low-priority = " << m_wallet->auto_low_priority();
success_msg_writer() << "segregate-pre-fork-outputs = " << m_wallet->segregate_pre_fork_outputs();
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
@@ -2357,6 +2421,8 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
CHECK_SIMPLE_VARIABLE("auto-low-priority", set_auto_low_priority, tr("0 or 1"));
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;
@@ -2512,6 +2578,9 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
if (!m_generate_new.empty() || m_restoring)
{
+ if (!m_subaddress_lookahead.empty() && !parse_subaddress_lookahead(m_subaddress_lookahead))
+ return false;
+
std::string old_language;
// check for recover flag. if present, require electrum word list (only recovery option for now).
if (m_restore_deterministic_wallet || m_restore_multisig_wallet)
@@ -3004,6 +3073,11 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
else
{
assert(!m_wallet_file.empty());
+ if (!m_subaddress_lookahead.empty())
+ {
+ fail_msg_writer() << tr("can't specify --subaddress-lookahead and --wallet-file at the same time");
+ return false;
+ }
bool r = open_wallet(vm);
CHECK_AND_ASSERT_MES(r, false, tr("failed to open account"));
}
@@ -3059,6 +3133,8 @@ bool simple_wallet::handle_command_line(const boost::program_options::variables_
m_allow_mismatched_daemon_version = command_line::get_arg(vm, arg_allow_mismatched_daemon_version);
m_restore_height = command_line::get_arg(vm, arg_restore_height);
m_do_not_relay = command_line::get_arg(vm, arg_do_not_relay);
+ m_subaddress_lookahead = command_line::get_arg(vm, arg_subaddress_lookahead);
+ m_use_english_language_names = command_line::get_arg(vm, arg_use_english_language_names);
m_restoring = !m_generate_from_view_key.empty() ||
!m_generate_from_spend_key.empty() ||
!m_generate_from_keys.empty() ||
@@ -3105,8 +3181,9 @@ std::string simple_wallet::get_mnemonic_language()
std::vector<std::string> language_list;
std::string language_choice;
int language_number = -1;
- crypto::ElectrumWords::get_language_list(language_list);
+ crypto::ElectrumWords::get_language_list(language_list, m_use_english_language_names);
std::cout << tr("List of available languages for your wallet's seed:") << std::endl;
+ std::cout << tr("If your display freezes, exit blind with ^C, then run again with --use-english-language-names") << std::endl;
int ii;
std::vector<std::string>::iterator it;
for (it = language_list.begin(), ii = 0; it != language_list.end(); it++, ii++)
@@ -3159,6 +3236,13 @@ bool simple_wallet::new_wallet(const boost::program_options::variables_map& vm,
return false;
}
+ if (!m_subaddress_lookahead.empty())
+ {
+ auto lookahead = parse_subaddress_lookahead(m_subaddress_lookahead);
+ assert(lookahead);
+ m_wallet->set_subaddress_lookahead(lookahead->first, lookahead->second);
+ }
+
bool was_deprecated_wallet = m_restore_deterministic_wallet && ((old_language == crypto::ElectrumWords::old_language_name) ||
crypto::ElectrumWords::get_is_old_style_seed(m_electrum_seed));
@@ -3242,6 +3326,14 @@ bool simple_wallet::new_wallet(const boost::program_options::variables_map& vm,
{
return false;
}
+
+ if (!m_subaddress_lookahead.empty())
+ {
+ auto lookahead = parse_subaddress_lookahead(m_subaddress_lookahead);
+ assert(lookahead);
+ m_wallet->set_subaddress_lookahead(lookahead->first, lookahead->second);
+ }
+
if (m_restore_height)
m_wallet->set_refresh_from_block_height(m_restore_height);
@@ -3279,6 +3371,14 @@ bool simple_wallet::new_wallet(const boost::program_options::variables_map& vm,
{
return false;
}
+
+ if (!m_subaddress_lookahead.empty())
+ {
+ auto lookahead = parse_subaddress_lookahead(m_subaddress_lookahead);
+ assert(lookahead);
+ m_wallet->set_subaddress_lookahead(lookahead->first, lookahead->second);
+ }
+
if (m_restore_height)
m_wallet->set_refresh_from_block_height(m_restore_height);
@@ -3307,6 +3407,13 @@ bool simple_wallet::new_wallet(const boost::program_options::variables_map& vm,
return false;
}
+ if (!m_subaddress_lookahead.empty())
+ {
+ auto lookahead = parse_subaddress_lookahead(m_subaddress_lookahead);
+ assert(lookahead);
+ m_wallet->set_subaddress_lookahead(lookahead->first, lookahead->second);
+ }
+
std::string mnemonic_language = old_language;
std::vector<std::string> language_list;
@@ -7342,6 +7449,8 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_params, arg_restore_height);
command_line::add_arg(desc_params, arg_do_not_relay);
command_line::add_arg(desc_params, arg_create_address_file);
+ command_line::add_arg(desc_params, arg_subaddress_lookahead);
+ command_line::add_arg(desc_params, arg_use_english_language_names);
po::positional_options_description positional_options;
positional_options.add(arg_command.name, -1);
diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h
index c69df817d..f26f69353 100644
--- a/src/simplewallet/simplewallet.h
+++ b/src/simplewallet/simplewallet.h
@@ -135,6 +135,8 @@ namespace cryptonote
bool set_auto_low_priority(const std::vector<std::string> &args = std::vector<std::string>());
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);
@@ -320,6 +322,7 @@ namespace cryptonote
std::string m_generate_from_json;
std::string m_mnemonic_language;
std::string m_import_path;
+ std::string m_subaddress_lookahead;
std::string m_electrum_seed; // electrum-style seed parameter
@@ -332,6 +335,7 @@ namespace cryptonote
bool m_restoring; // are we restoring, by whatever method?
uint64_t m_restore_height; // optional
bool m_do_not_relay;
+ bool m_use_english_language_names;
epee::console_handlers_binder m_cmd_binder;
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index d6fb1edb8..4b7e6dd93 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -65,6 +65,7 @@ using namespace epee;
#include "common/json_util.h"
#include "memwipe.h"
#include "common/base58.h"
+#include "common/dns_utils.h"
#include "ringct/rctSigs.h"
#include "ringdb.h"
@@ -662,6 +663,7 @@ wallet2::wallet2(network_type nettype, bool restricted):
m_auto_low_priority(true),
m_segregate_pre_fork_outputs(true),
m_key_reuse_mitigation2(true),
+ m_segregation_height(0),
m_is_initialized(false),
m_restricted(restricted),
is_old_file_format(false),
@@ -2594,6 +2596,9 @@ bool wallet2::store_keys(const std::string& keys_file_name, const epee::wipeable
value2.SetInt(m_key_reuse_mitigation2 ? 1 : 0);
json.AddMember("key_reuse_mitigation2", value2, json.GetAllocator());
+ value2.SetUint(m_segregation_height);
+ json.AddMember("segregation_height", value2, json.GetAllocator());
+
// Serialize the JSON object
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
@@ -5774,14 +5779,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
if (fake_outputs_count > 0)
{
- uint64_t segregation_fork_height;
- switch (m_nettype)
- {
- case TESTNET: segregation_fork_height = TESTNET_SEGREGATION_FORK_HEIGHT; break;
- case STAGENET: segregation_fork_height = STAGENET_SEGREGATION_FORK_HEIGHT; break;
- case MAINNET: segregation_fork_height = SEGREGATION_FORK_HEIGHT; break;
- default: THROW_WALLET_EXCEPTION(error::wallet_internal_error, "Invalid network type");
- }
+ uint64_t segregation_fork_height = get_segregation_fork_height();
// check whether we're shortly after the fork
uint64_t height;
boost::optional<std::string> result = m_node_rpc_proxy.get_height(height);
@@ -10324,6 +10322,58 @@ std::vector<std::pair<uint64_t, uint64_t>> wallet2::estimate_backlog(uint64_t mi
return estimate_backlog(fee_levels);
}
//----------------------------------------------------------------------------------------------------
+uint64_t wallet2::get_segregation_fork_height() const
+{
+ if (m_nettype == TESTNET)
+ return TESTNET_SEGREGATION_FORK_HEIGHT;
+ if (m_nettype == STAGENET)
+ return STAGENET_SEGREGATION_FORK_HEIGHT;
+ THROW_WALLET_EXCEPTION_IF(m_nettype != MAINNET, tools::error::wallet_internal_error, "Invalid network type");
+
+ if (m_segregation_height > 0)
+ return m_segregation_height;
+
+ static const bool use_dns = true;
+ if (use_dns)
+ {
+ // All four MoneroPulse domains have DNSSEC on and valid
+ static const std::vector<std::string> dns_urls = {
+ "segheights.moneropulse.org",
+ "segheights.moneropulse.net",
+ "segheights.moneropulse.co",
+ "segheights.moneropulse.se"
+ };
+
+ const uint64_t current_height = get_blockchain_current_height();
+ uint64_t best_diff = std::numeric_limits<uint64_t>::max(), best_height = 0;
+ std::vector<std::string> records;
+ if (tools::dns_utils::load_txt_records_from_dns(records, dns_urls))
+ {
+ for (const auto& record : records)
+ {
+ std::vector<std::string> fields;
+ boost::split(fields, record, boost::is_any_of(":"));
+ if (fields.size() != 2)
+ continue;
+ uint64_t height;
+ if (!string_tools::get_xtype_from_string(height, fields[1]))
+ continue;
+
+ MINFO("Found segregation height via DNS: " << fields[0] << " fork height at " << height);
+ uint64_t diff = height > current_height ? height - current_height : current_height - height;
+ if (diff < best_diff)
+ {
+ best_diff = diff;
+ best_height = height;
+ }
+ }
+ if (best_height)
+ return best_height;
+ }
+ }
+ return SEGREGATION_FORK_HEIGHT;
+}
+//----------------------------------------------------------------------------------------------------
void wallet2::generate_genesis(cryptonote::block& b) const {
if (m_nettype == TESTNET)
{
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h
index 46f1ddc2d..abc7bb538 100644
--- a/src/wallet/wallet2.h
+++ b/src/wallet/wallet2.h
@@ -635,6 +635,7 @@ namespace tools
std::string get_subaddress_label(const cryptonote::subaddress_index& index) const;
void set_subaddress_label(const cryptonote::subaddress_index &index, const std::string &label);
void set_subaddress_lookahead(size_t major, size_t minor);
+ std::pair<size_t, size_t> get_subaddress_lookahead() const { return {m_subaddress_lookahead_major, m_subaddress_lookahead_minor}; }
/*!
* \brief Tells if the wallet file is deprecated.
*/
@@ -871,6 +872,8 @@ namespace tools
void segregate_pre_fork_outputs(bool value) { m_segregate_pre_fork_outputs = value; }
bool key_reuse_mitigation2() const { return m_key_reuse_mitigation2; }
void key_reuse_mitigation2(bool value) { m_key_reuse_mitigation2 = value; }
+ uint64_t segregation_height() const { return m_segregation_height; }
+ void segregation_height(uint64_t height) { m_segregation_height = height; }
bool get_tx_key(const crypto::hash &txid, crypto::secret_key &tx_key, std::vector<crypto::secret_key> &additional_tx_keys) const;
void check_tx_key(const crypto::hash &txid, const crypto::secret_key &tx_key, const std::vector<crypto::secret_key> &additional_tx_keys, const cryptonote::account_public_address &address, uint64_t &received, bool &in_pool, uint64_t &confirmations);
@@ -1133,6 +1136,8 @@ namespace tools
bool get_output_distribution(uint64_t &start_height, std::vector<uint64_t> &distribution);
+ uint64_t get_segregation_fork_height() const;
+
cryptonote::account_base m_account;
boost::optional<epee::net_utils::http::login> m_daemon_login;
std::string m_daemon_address;
@@ -1199,6 +1204,7 @@ namespace tools
bool m_auto_low_priority;
bool m_segregate_pre_fork_outputs;
bool m_key_reuse_mitigation2;
+ uint64_t m_segregation_height;
bool m_is_initialized;
NodeRPCProxy m_node_rpc_proxy;
std::unordered_set<crypto::hash> m_scanned_pool_txs[2];
diff --git a/src/wallet/wallet_rpc_server.h b/src/wallet/wallet_rpc_server.h
index 63e886dda..2ec53cc80 100644
--- a/src/wallet/wallet_rpc_server.h
+++ b/src/wallet/wallet_rpc_server.h
@@ -85,6 +85,7 @@ namespace tools
MAP_JON_RPC_WE("transfer", on_transfer, wallet_rpc::COMMAND_RPC_TRANSFER)
MAP_JON_RPC_WE("transfer_split", on_transfer_split, wallet_rpc::COMMAND_RPC_TRANSFER_SPLIT)
MAP_JON_RPC_WE("sweep_dust", on_sweep_dust, wallet_rpc::COMMAND_RPC_SWEEP_DUST)
+ MAP_JON_RPC_WE("sweep_unmixable", on_sweep_dust, wallet_rpc::COMMAND_RPC_SWEEP_DUST)
MAP_JON_RPC_WE("sweep_all", on_sweep_all, wallet_rpc::COMMAND_RPC_SWEEP_ALL)
MAP_JON_RPC_WE("sweep_single", on_sweep_single, wallet_rpc::COMMAND_RPC_SWEEP_SINGLE)
MAP_JON_RPC_WE("relay_tx", on_relay_tx, wallet_rpc::COMMAND_RPC_RELAY_TX)