aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/server.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2016-10-30 16:58:13 +0100
committerMarcoFalke <falke.marco@gmail.com>2016-10-31 10:46:52 +0100
commitfa326193ad739d1f93da456b3fa73af0bbf9fdd1 (patch)
tree67be00066a7d06c25ffa5b67e2ca530137af60d4 /src/rpc/server.cpp
parentd2143dc937e3fc93fd35def25a9c0461f26ccd4f (diff)
[rpc] ParseHash: Fail when length is not 64
Diffstat (limited to 'src/rpc/server.cpp')
-rw-r--r--src/rpc/server.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp
index 29d0bee1b2..164e0f00e2 100644
--- a/src/rpc/server.cpp
+++ b/src/rpc/server.cpp
@@ -147,6 +147,8 @@ uint256 ParseHashV(const UniValue& v, string strName)
strHex = v.get_str();
if (!IsHex(strHex)) // Note: IsHex("") is false
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;
result.SetHex(strHex);
return result;