diff options
author | Suhas Daftuar <sdaftuar@gmail.com> | 2017-05-07 14:10:19 -0400 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@chaincode.com> | 2017-09-05 15:05:28 -0400 |
commit | 0311836f6927aec4ba5687ea12af35df3c509682 (patch) | |
tree | 5d1b35310828f7299e039476a52146140f6bb0fc /src/utilstrencodings.cpp | |
parent | e0e3cbbf081b74ed5322176dcda081c64076fd21 (diff) |
Allow setting nMinimumChainWork on command line
Diffstat (limited to 'src/utilstrencodings.cpp')
-rw-r--r-- | src/utilstrencodings.cpp | 13 |
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 |