aboutsummaryrefslogtreecommitdiff
path: root/src/utilstrencodings.cpp
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2017-05-07 14:10:19 -0400
committerMarcoFalke <falke.marco@gmail.com>2017-11-02 13:08:43 -0400
commitda4908c3a05659846dae81b8d0bd73a04f7ed7c9 (patch)
treec3c0269c5244bb2bffd2459417c9ef34cdb77f3c /src/utilstrencodings.cpp
parent41088795dd9a1c90bb379b2d5237d88ae8889c90 (diff)
downloadbitcoin-da4908c3a05659846dae81b8d0bd73a04f7ed7c9.tar.xz
Allow setting nMinimumChainWork on command line
Github-Pull: #10357 Rebased-From: 0311836f6927aec4ba5687ea12af35df3c509682
Diffstat (limited to 'src/utilstrencodings.cpp')
-rw-r--r--src/utilstrencodings.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/utilstrencodings.cpp b/src/utilstrencodings.cpp
index fd233f6757..741680e93f 100644
--- a/src/utilstrencodings.cpp
+++ b/src/utilstrencodings.cpp
@@ -65,6 +65,19 @@ bool IsHex(const std::string& str)
return (str.size() > 0) && (str.size()%2 == 0);
}
+bool IsHexNumber(const std::string& str)
+{
+ size_t starting_location = 0;
+ if (str.size() > 2 && *str.begin() == '0' && *(str.begin()+1) == 'x') {
+ starting_location = 2;
+ }
+ for (auto c : str.substr(starting_location)) {
+ if (HexDigit(c) < 0) return false;
+ }
+ // Return false for empty string or "0x".
+ return (str.size() > starting_location);
+}
+
std::vector<unsigned char> ParseHex(const char* psz)
{
// convert hex dump to vector