#include <boost/format.hpp>
#include <boost/assign/list_of.hpp>
-#include <boost/iterator/counting_iterator.hpp>
using namespace json_spirit;
using namespace std;
"getmininginfo\n"
"Returns an object containing mining-related information.");
- Object obj, diff, weight;
+ Object obj, diff;
obj.push_back(Pair("blocks", (int)nBestHeight));
obj.push_back(Pair("currentblocksize",(uint64_t)nLastBlockSize));
obj.push_back(Pair("currentblocktx",(uint64_t)nLastBlockTx));
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<int>(boost::counting_iterator<int>( 0 ), boost::counting_iterator<int>( tx.vout.size() ));
+ for (size_t i = 0; i != tx.vout.size(); ++i) vInputs.push_back(i);
}
CTxDB txdb("r");