Changeset View
Changeset View
Standalone View
Standalone View
src/core_read.cpp
Show First 20 Lines • Show All 224 Lines • ▼ Show 20 Lines | try { | ||||
ssBlock >> block; | ssBlock >> block; | ||||
} catch (const std::exception &) { | } catch (const std::exception &) { | ||||
return false; | return false; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
uint256 ParseHashUV(const UniValue &v, const std::string &strName) { | |||||
std::string strHex; | |||||
if (v.isStr()) { | |||||
strHex = v.getValStr(); | |||||
} | |||||
// Note: ParseHashStr("") throws a runtime_error | |||||
return ParseHashStr(strHex, strName); | |||||
} | |||||
uint256 ParseHashStr(const std::string &strHex, const std::string &strName) { | uint256 ParseHashStr(const std::string &strHex, const std::string &strName) { | ||||
if (!IsHex(strHex)) { | if (!IsHex(strHex)) { | ||||
// Note: IsHex("") is false | // Note: IsHex("") is false | ||||
throw std::runtime_error( | throw std::runtime_error( | ||||
strName + " must be hexadecimal string (not '" + strHex + "')"); | strName + " must be hexadecimal string (not '" + strHex + "')"); | ||||
} | } | ||||
uint256 result; | uint256 result; | ||||
Show All 17 Lines |