From: CryptoManiac Date: Sun, 18 Oct 2015 14:23:40 +0000 (+0300) Subject: Scaninput RPC: Handle integer value correctly, it's not necesary to pass array value... X-Git-Tag: nvc-v0.5.5~15 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=68a4fcd79105096039eb8891d42e619171e16933;hp=9b9454a448ecf58ef77afb83cdb6f24b2d410130 Scaninput RPC: Handle integer value correctly, it's not necesary to pass array value for a single input. --- diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp index 498e1af..fa1eb19 100644 --- a/src/rpcmining.cpp +++ b/src/rpcmining.cpp @@ -147,6 +147,18 @@ Value scaninput(const Array& params, bool fHelp) vInputs.push_back(nOut); } } + else if(inputs_v.type() == int_type) + { + int nOut = inputs_v.get_int(); + if (nOut < 0 || nOut > (int)tx.vout.size() - 1) + { + stringstream strErrorMsg; + strErrorMsg << boost::format("Invalid parameter, input number %d is out of range") % nOut; + throw JSONRPCError(RPC_INVALID_PARAMETER, strErrorMsg.str()); + } + + vInputs.push_back(nOut); + } else { vInputs = vector(boost::counting_iterator( 0 ), boost::counting_iterator( tx.vout.size() ));