From da4908c3a05659846dae81b8d0bd73a04f7ed7c9 Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Sun, 7 May 2017 14:10:19 -0400 Subject: Allow setting nMinimumChainWork on command line Github-Pull: #10357 Rebased-From: 0311836f6927aec4ba5687ea12af35df3c509682 --- src/utilstrencodings.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/utilstrencodings.cpp') 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 ParseHex(const char* psz) { // convert hex dump to vector -- cgit v1.2.3