diff options
author | stoffu <stoffu@protonmail.ch> | 2018-06-04 16:54:35 +0900 |
---|---|---|
committer | stoffu <stoffu@protonmail.ch> | 2018-06-21 12:36:17 +0900 |
commit | 248310de0666d9c12e6e861043386419da63f3b1 (patch) | |
tree | 2e4101062a43ab76c6fcabb54a946d4b4b479e34 /src/common/util.cpp | |
parent | wallet2: lower default for subaddress lookahead when restoring with hardware (diff) | |
download | monero-248310de0666d9c12e6e861043386419da63f3b1.tar.xz |
Move parse_subaddress_lookahead() from simplewallet.cpp to util.cpp
Diffstat (limited to 'src/common/util.cpp')
-rw-r--r-- | src/common/util.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/common/util.cpp b/src/common/util.cpp index 3f330fa13..329352e94 100644 --- a/src/common/util.cpp +++ b/src/common/util.cpp @@ -827,4 +827,22 @@ std::string get_nix_version_display_string() return false; 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 + { + return {}; + } + } } |