| 121 | } |
| 122 | |
| 123 | uint256 ParseHashV(const Value& v, string strName) { |
| 124 | string strHex; |
| 125 | if (v.type() == str_type) |
| 126 | strHex = v.get_str(); |
| 127 | if (!IsHex(strHex)) // Note: IsHex("") is false |
| 128 | throw JSONRPCError(RPC_INVALID_PARAMETER, strName + " must be hexadecimal string (not '" + strHex + "')"); |
| 129 | |
| 130 | uint256 result; |
| 131 | result.SetHex(strHex); |
| 132 | |
| 133 | return result; |
| 134 | } |
| 135 | uint256 ParseHashO(const Object& o, string strKey) { |
| 136 | return ParseHashV(find_value(o, strKey), strKey); |
| 137 | } |
no test coverage detected