Changeset View
Changeset View
Standalone View
Standalone View
src/core_read.cpp
Show First 20 Lines • Show All 239 Lines • ▼ Show 20 Lines | try { | ||||
} | } | ||||
} catch (const std::exception &e) { | } catch (const std::exception &e) { | ||||
error = e.what(); | error = e.what(); | ||||
return false; | return false; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
uint256 ParseHashStr(const std::string &strHex, const std::string &strName) { | bool ParseHashStr(const std::string &strHex, uint256 &result) { | ||||
if (!IsHex(strHex)) { | if ((strHex.size() != 64) || !IsHex(strHex)) { | ||||
// Note: IsHex("") is false | return false; | ||||
throw std::runtime_error( | |||||
strName + " must be hexadecimal string (not '" + strHex + "')"); | |||||
} | } | ||||
uint256 result; | |||||
result.SetHex(strHex); | result.SetHex(strHex); | ||||
return result; | return true; | ||||
} | } | ||||
std::vector<uint8_t> ParseHexUV(const UniValue &v, const std::string &strName) { | std::vector<uint8_t> ParseHexUV(const UniValue &v, const std::string &strName) { | ||||
std::string strHex; | std::string strHex; | ||||
if (v.isStr()) { | if (v.isStr()) { | ||||
strHex = v.getValStr(); | strHex = v.getValStr(); | ||||
} | } | ||||
Show All 39 Lines |