aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2018-06-25 14:49:30 -0500
committerluigi1111 <luigi1111w@gmail.com>2018-06-25 14:49:30 -0500
commit473d984d88294fe6820c52094d96a0abcb8e9a90 (patch)
tree69ac017b982c55d8ce4e2b2005320eb77deb79e4 /src/common
parentMerge pull request #3677 (diff)
parentWallet API: add support for wallet creation from hardware device (diff)
downloadmonero-473d984d88294fe6820c52094d96a0abcb8e9a90.tar.xz
Merge pull request #3921
8fc0cdb wallet2: lower default for subaddress lookahead when restoring with hardware (stoffu) 248310d Move parse_subaddress_lookahead() from simplewallet.cpp to util.cpp (stoffu) 46e90b7 Wallet API: add support for wallet creation from hardware device (stoffu)
Diffstat (limited to '')
-rw-r--r--src/common/util.cpp18
-rw-r--r--src/common/util.h3
2 files changed, 21 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 {};
+ }
+ }
}
diff --git a/src/common/util.h b/src/common/util.h
index 7caf0e3c5..dc426830b 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -32,6 +32,7 @@
#include <boost/thread/locks.hpp>
#include <boost/thread/mutex.hpp>
+#include <boost/optional.hpp>
#include <system_error>
#include <csignal>
#include <cstdio>
@@ -214,4 +215,6 @@ namespace tools
bool sha256sum(const std::string &filename, crypto::hash &hash);
bool is_hdd(const char *path);
+
+ boost::optional<std::pair<uint32_t, uint32_t>> parse_subaddress_lookahead(const std::string& str);
}