| 116 | } |
| 117 | |
| 118 | uint256 ParseHashV(const UniValue& v, std::string strName) |
| 119 | { |
| 120 | std::string strHex; |
| 121 | if (v.isStr()) |
| 122 | strHex = v.get_str(); |
| 123 | if (!IsHex(strHex)) // Note: IsHex("") is false |
| 124 | throw JSONRPCError(RPC_INVALID_PARAMETER, strName+" must be hexadecimal string (not '"+strHex+"')"); |
| 125 | if (64 != strHex.length()) |
| 126 | throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%s must be of length %d (not %d)", strName, 64, strHex.length())); |
| 127 | uint256 result; |
| 128 | result.SetHex(strHex); |
| 129 | return result; |
| 130 | } |
| 131 | uint256 ParseHashO(const UniValue& o, std::string strKey) |
| 132 | { |
| 133 | return ParseHashV(find_value(o, strKey), strKey); |
no test coverage detected