Require that z_importkey height parameter be in valid range

This commit is contained in:
Jack Grigg
2017-03-24 16:05:32 +13:00
parent 53c96bfa6c
commit 33589401ba
2 changed files with 11 additions and 0 deletions

View File

@@ -607,6 +607,9 @@ UniValue z_importkey(const UniValue& params, bool fHelp)
int nRescanHeight = 0;
if (params.size() > 2)
nRescanHeight = params[2].get_int();
if (nRescanHeight < 0 || nRescanHeight > chainActive.Height()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range");
}
string strSecret = params[0].get_str();
CZCSpendingKey spendingkey(strSecret);