| 127 | } |
| 128 | |
| 129 | uint256 ParseHashV(const UniValue& v, string strName) |
| 130 | { |
| 131 | string strHex; |
| 132 | if (v.isStr()) |
| 133 | strHex = v.get_str(); |
| 134 | if (!IsHex(strHex)) // Note: IsHex("") is false |
| 135 | throw JSONRPCError(RPC_INVALID_PARAMETER, strName + " must be hexadecimal string (not '" + strHex + "')"); |
| 136 | uint256 result = uint256(); |
| 137 | result.SetHex(strHex); |
| 138 | return result; |
| 139 | } |
| 140 | uint256 ParseHashO(const UniValue& o, string strKey) |
| 141 | { |
| 142 | return ParseHashV(find_value(o, strKey), strKey); |
no test coverage detected