From 68a4fcd79105096039eb8891d42e619171e16933 Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Sun, 18 Oct 2015 17:23:40 +0300 Subject: [PATCH] Scaninput RPC: Handle integer value correctly, it's not necesary to pass array value for a single input. --- src/rpcmining.cpp | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) 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() )); -- 1.7.1