mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-03-11 05:03:31 +00:00
Merge #9042: [rpc] ParseHash: Fail when length is not 64
fa32619 [rpc] ParseHash: Fail when length is not 64 (MarcoFalke)
This commit is contained in:
commit
bc785d7185
@ -147,6 +147,8 @@ uint256 ParseHashV(const UniValue& v, string strName)
|
|||||||
strHex = v.get_str();
|
strHex = v.get_str();
|
||||||
if (!IsHex(strHex)) // Note: IsHex("") is false
|
if (!IsHex(strHex)) // Note: IsHex("") is false
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, strName+" must be hexadecimal string (not '"+strHex+"')");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, strName+" must be hexadecimal string (not '"+strHex+"')");
|
||||||
|
if (64 != strHex.length())
|
||||||
|
throw JSONRPCError(RPC_INVALID_PARAMETER, strprintf("%s must be of length %d (not %d)", strName, 64, strHex.length()));
|
||||||
uint256 result;
|
uint256 result;
|
||||||
result.SetHex(strHex);
|
result.SetHex(strHex);
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user