unsigned int -> size_t for comparing with UniValue.size()
This commit is contained in:
@@ -347,7 +347,7 @@ static void MutateTxSign(CMutableTransaction& tx, const string& flagStr)
|
|||||||
UniValue keysObj = registers["privatekeys"];
|
UniValue keysObj = registers["privatekeys"];
|
||||||
fGivenKeys = true;
|
fGivenKeys = true;
|
||||||
|
|
||||||
for (unsigned int kidx = 0; kidx < keysObj.size(); kidx++) {
|
for (size_t kidx = 0; kidx < keysObj.size(); kidx++) {
|
||||||
if (!keysObj[kidx].isStr())
|
if (!keysObj[kidx].isStr())
|
||||||
throw runtime_error("privatekey not a string");
|
throw runtime_error("privatekey not a string");
|
||||||
CBitcoinSecret vchSecret;
|
CBitcoinSecret vchSecret;
|
||||||
@@ -364,7 +364,7 @@ static void MutateTxSign(CMutableTransaction& tx, const string& flagStr)
|
|||||||
throw runtime_error("prevtxs register variable must be set.");
|
throw runtime_error("prevtxs register variable must be set.");
|
||||||
UniValue prevtxsObj = registers["prevtxs"];
|
UniValue prevtxsObj = registers["prevtxs"];
|
||||||
{
|
{
|
||||||
for (unsigned int previdx = 0; previdx < prevtxsObj.size(); previdx++) {
|
for (size_t previdx = 0; previdx < prevtxsObj.size(); previdx++) {
|
||||||
UniValue prevOut = prevtxsObj[previdx];
|
UniValue prevOut = prevtxsObj[previdx];
|
||||||
if (!prevOut.isObject())
|
if (!prevOut.isObject())
|
||||||
throw runtime_error("expected prevtxs internal object");
|
throw runtime_error("expected prevtxs internal object");
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ UniValue gettxoutproof(const UniValue& params, bool fHelp)
|
|||||||
set<uint256> setTxids;
|
set<uint256> setTxids;
|
||||||
uint256 oneTxid;
|
uint256 oneTxid;
|
||||||
UniValue txids = params[0].get_array();
|
UniValue txids = params[0].get_array();
|
||||||
for (unsigned int idx = 0; idx < txids.size(); idx++) {
|
for (size_t idx = 0; idx < txids.size(); idx++) {
|
||||||
const UniValue& txid = txids[idx];
|
const UniValue& txid = txids[idx];
|
||||||
if (txid.get_str().length() != 64 || !IsHex(txid.get_str()))
|
if (txid.get_str().length() != 64 || !IsHex(txid.get_str()))
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid txid ")+txid.get_str());
|
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid txid ")+txid.get_str());
|
||||||
@@ -436,7 +436,7 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp)
|
|||||||
|
|
||||||
CMutableTransaction rawTx;
|
CMutableTransaction rawTx;
|
||||||
|
|
||||||
for (unsigned int idx = 0; idx < inputs.size(); idx++) {
|
for (size_t idx = 0; idx < inputs.size(); idx++) {
|
||||||
const UniValue& input = inputs[idx];
|
const UniValue& input = inputs[idx];
|
||||||
const UniValue& o = input.get_obj();
|
const UniValue& o = input.get_obj();
|
||||||
|
|
||||||
@@ -731,7 +731,7 @@ UniValue signrawtransaction(const UniValue& params, bool fHelp)
|
|||||||
if (params.size() > 2 && !params[2].isNull()) {
|
if (params.size() > 2 && !params[2].isNull()) {
|
||||||
fGivenKeys = true;
|
fGivenKeys = true;
|
||||||
UniValue keys = params[2].get_array();
|
UniValue keys = params[2].get_array();
|
||||||
for (unsigned int idx = 0; idx < keys.size(); idx++) {
|
for (size_t idx = 0; idx < keys.size(); idx++) {
|
||||||
UniValue k = keys[idx];
|
UniValue k = keys[idx];
|
||||||
CBitcoinSecret vchSecret;
|
CBitcoinSecret vchSecret;
|
||||||
bool fGood = vchSecret.SetString(k.get_str());
|
bool fGood = vchSecret.SetString(k.get_str());
|
||||||
@@ -751,7 +751,7 @@ UniValue signrawtransaction(const UniValue& params, bool fHelp)
|
|||||||
// Add previous txouts given in the RPC call:
|
// Add previous txouts given in the RPC call:
|
||||||
if (params.size() > 1 && !params[1].isNull()) {
|
if (params.size() > 1 && !params[1].isNull()) {
|
||||||
UniValue prevTxs = params[1].get_array();
|
UniValue prevTxs = params[1].get_array();
|
||||||
for (unsigned int idx = 0; idx < prevTxs.size(); idx++) {
|
for (size_t idx = 0; idx < prevTxs.size(); idx++) {
|
||||||
const UniValue& p = prevTxs[idx];
|
const UniValue& p = prevTxs[idx];
|
||||||
if (!p.isObject())
|
if (!p.isObject())
|
||||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "expected object with {\"txid'\",\"vout\",\"scriptPubKey\"}");
|
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "expected object with {\"txid'\",\"vout\",\"scriptPubKey\"}");
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ void RPCTypeCheck(const UniValue& params,
|
|||||||
const list<UniValue::VType>& typesExpected,
|
const list<UniValue::VType>& typesExpected,
|
||||||
bool fAllowNull)
|
bool fAllowNull)
|
||||||
{
|
{
|
||||||
unsigned int i = 0;
|
size_t i = 0;
|
||||||
BOOST_FOREACH(UniValue::VType t, typesExpected)
|
BOOST_FOREACH(UniValue::VType t, typesExpected)
|
||||||
{
|
{
|
||||||
if (params.size() <= i)
|
if (params.size() <= i)
|
||||||
@@ -928,7 +928,7 @@ static UniValue JSONRPCExecOne(const UniValue& req)
|
|||||||
static string JSONRPCExecBatch(const UniValue& vReq)
|
static string JSONRPCExecBatch(const UniValue& vReq)
|
||||||
{
|
{
|
||||||
UniValue ret(UniValue::VARR);
|
UniValue ret(UniValue::VARR);
|
||||||
for (unsigned int reqIdx = 0; reqIdx < vReq.size(); reqIdx++)
|
for (size_t reqIdx = 0; reqIdx < vReq.size(); reqIdx++)
|
||||||
ret.push_back(JSONRPCExecOne(vReq[reqIdx]));
|
ret.push_back(JSONRPCExecOne(vReq[reqIdx]));
|
||||||
|
|
||||||
return ret.write() + "\n";
|
return ret.write() + "\n";
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ BOOST_FIXTURE_TEST_SUITE(base58_tests, BasicTestingSetup)
|
|||||||
BOOST_AUTO_TEST_CASE(base58_EncodeBase58)
|
BOOST_AUTO_TEST_CASE(base58_EncodeBase58)
|
||||||
{
|
{
|
||||||
UniValue tests = read_json(std::string(json_tests::base58_encode_decode, json_tests::base58_encode_decode + sizeof(json_tests::base58_encode_decode)));
|
UniValue tests = read_json(std::string(json_tests::base58_encode_decode, json_tests::base58_encode_decode + sizeof(json_tests::base58_encode_decode)));
|
||||||
for (unsigned int idx = 0; idx < tests.size(); idx++) {
|
for (size_t idx = 0; idx < tests.size(); idx++) {
|
||||||
UniValue test = tests[idx];
|
UniValue test = tests[idx];
|
||||||
std::string strTest = test.write();
|
std::string strTest = test.write();
|
||||||
if (test.size() < 2) // Allow for extra stuff (useful for comments)
|
if (test.size() < 2) // Allow for extra stuff (useful for comments)
|
||||||
@@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE(base58_DecodeBase58)
|
|||||||
UniValue tests = read_json(std::string(json_tests::base58_encode_decode, json_tests::base58_encode_decode + sizeof(json_tests::base58_encode_decode)));
|
UniValue tests = read_json(std::string(json_tests::base58_encode_decode, json_tests::base58_encode_decode + sizeof(json_tests::base58_encode_decode)));
|
||||||
std::vector<unsigned char> result;
|
std::vector<unsigned char> result;
|
||||||
|
|
||||||
for (unsigned int idx = 0; idx < tests.size(); idx++) {
|
for (size_t idx = 0; idx < tests.size(); idx++) {
|
||||||
UniValue test = tests[idx];
|
UniValue test = tests[idx];
|
||||||
std::string strTest = test.write();
|
std::string strTest = test.write();
|
||||||
if (test.size() < 2) // Allow for extra stuff (useful for comments)
|
if (test.size() < 2) // Allow for extra stuff (useful for comments)
|
||||||
@@ -126,7 +126,7 @@ BOOST_AUTO_TEST_CASE(base58_keys_valid_parse)
|
|||||||
CBitcoinAddress addr;
|
CBitcoinAddress addr;
|
||||||
SelectParams(CBaseChainParams::MAIN);
|
SelectParams(CBaseChainParams::MAIN);
|
||||||
|
|
||||||
for (unsigned int idx = 0; idx < tests.size(); idx++) {
|
for (size_t idx = 0; idx < tests.size(); idx++) {
|
||||||
UniValue test = tests[idx];
|
UniValue test = tests[idx];
|
||||||
std::string strTest = test.write();
|
std::string strTest = test.write();
|
||||||
if (test.size() < 3) // Allow for extra stuff (useful for comments)
|
if (test.size() < 3) // Allow for extra stuff (useful for comments)
|
||||||
@@ -181,7 +181,7 @@ BOOST_AUTO_TEST_CASE(base58_keys_valid_gen)
|
|||||||
UniValue tests = read_json(std::string(json_tests::base58_keys_valid, json_tests::base58_keys_valid + sizeof(json_tests::base58_keys_valid)));
|
UniValue tests = read_json(std::string(json_tests::base58_keys_valid, json_tests::base58_keys_valid + sizeof(json_tests::base58_keys_valid)));
|
||||||
std::vector<unsigned char> result;
|
std::vector<unsigned char> result;
|
||||||
|
|
||||||
for (unsigned int idx = 0; idx < tests.size(); idx++) {
|
for (size_t idx = 0; idx < tests.size(); idx++) {
|
||||||
UniValue test = tests[idx];
|
UniValue test = tests[idx];
|
||||||
std::string strTest = test.write();
|
std::string strTest = test.write();
|
||||||
if (test.size() < 3) // Allow for extra stuff (useful for comments)
|
if (test.size() < 3) // Allow for extra stuff (useful for comments)
|
||||||
@@ -251,7 +251,7 @@ BOOST_AUTO_TEST_CASE(base58_keys_invalid)
|
|||||||
CBitcoinSecret secret;
|
CBitcoinSecret secret;
|
||||||
CBitcoinAddress addr;
|
CBitcoinAddress addr;
|
||||||
|
|
||||||
for (unsigned int idx = 0; idx < tests.size(); idx++) {
|
for (size_t idx = 0; idx < tests.size(); idx++) {
|
||||||
UniValue test = tests[idx];
|
UniValue test = tests[idx];
|
||||||
std::string strTest = test.write();
|
std::string strTest = test.write();
|
||||||
if (test.size() < 1) // Allow for extra stuff (useful for comments)
|
if (test.size() < 1) // Allow for extra stuff (useful for comments)
|
||||||
|
|||||||
@@ -583,11 +583,11 @@ BOOST_AUTO_TEST_CASE(script_build)
|
|||||||
UniValue json_good = read_json(std::string(json_tests::script_valid, json_tests::script_valid + sizeof(json_tests::script_valid)));
|
UniValue json_good = read_json(std::string(json_tests::script_valid, json_tests::script_valid + sizeof(json_tests::script_valid)));
|
||||||
UniValue json_bad = read_json(std::string(json_tests::script_invalid, json_tests::script_invalid + sizeof(json_tests::script_invalid)));
|
UniValue json_bad = read_json(std::string(json_tests::script_invalid, json_tests::script_invalid + sizeof(json_tests::script_invalid)));
|
||||||
|
|
||||||
for (unsigned int idx = 0; idx < json_good.size(); idx++) {
|
for (size_t idx = 0; idx < json_good.size(); idx++) {
|
||||||
const UniValue& tv = json_good[idx];
|
const UniValue& tv = json_good[idx];
|
||||||
tests_good.insert(tv.get_array().write());
|
tests_good.insert(tv.get_array().write());
|
||||||
}
|
}
|
||||||
for (unsigned int idx = 0; idx < json_bad.size(); idx++) {
|
for (size_t idx = 0; idx < json_bad.size(); idx++) {
|
||||||
const UniValue& tv = json_bad[idx];
|
const UniValue& tv = json_bad[idx];
|
||||||
tests_bad.insert(tv.get_array().write());
|
tests_bad.insert(tv.get_array().write());
|
||||||
}
|
}
|
||||||
@@ -636,7 +636,7 @@ BOOST_AUTO_TEST_CASE(script_valid)
|
|||||||
// scripts.
|
// scripts.
|
||||||
UniValue tests = read_json(std::string(json_tests::script_valid, json_tests::script_valid + sizeof(json_tests::script_valid)));
|
UniValue tests = read_json(std::string(json_tests::script_valid, json_tests::script_valid + sizeof(json_tests::script_valid)));
|
||||||
|
|
||||||
for (unsigned int idx = 0; idx < tests.size(); idx++) {
|
for (size_t idx = 0; idx < tests.size(); idx++) {
|
||||||
UniValue test = tests[idx];
|
UniValue test = tests[idx];
|
||||||
string strTest = test.write();
|
string strTest = test.write();
|
||||||
if (test.size() < 3) // Allow size > 3; extra stuff ignored (useful for comments)
|
if (test.size() < 3) // Allow size > 3; extra stuff ignored (useful for comments)
|
||||||
@@ -661,7 +661,7 @@ BOOST_AUTO_TEST_CASE(script_invalid)
|
|||||||
// Scripts that should evaluate as invalid
|
// Scripts that should evaluate as invalid
|
||||||
UniValue tests = read_json(std::string(json_tests::script_invalid, json_tests::script_invalid + sizeof(json_tests::script_invalid)));
|
UniValue tests = read_json(std::string(json_tests::script_invalid, json_tests::script_invalid + sizeof(json_tests::script_invalid)));
|
||||||
|
|
||||||
for (unsigned int idx = 0; idx < tests.size(); idx++) {
|
for (size_t idx = 0; idx < tests.size(); idx++) {
|
||||||
UniValue test = tests[idx];
|
UniValue test = tests[idx];
|
||||||
string strTest = test.write();
|
string strTest = test.write();
|
||||||
if (test.size() < 3) // Allow size > 2; extra stuff ignored (useful for comments)
|
if (test.size() < 3) // Allow size > 2; extra stuff ignored (useful for comments)
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ BOOST_AUTO_TEST_CASE(sighash_from_data)
|
|||||||
{
|
{
|
||||||
UniValue tests = read_json(std::string(json_tests::sighash, json_tests::sighash + sizeof(json_tests::sighash)));
|
UniValue tests = read_json(std::string(json_tests::sighash, json_tests::sighash + sizeof(json_tests::sighash)));
|
||||||
|
|
||||||
for (unsigned int idx = 0; idx < tests.size(); idx++) {
|
for (size_t idx = 0; idx < tests.size(); idx++) {
|
||||||
UniValue test = tests[idx];
|
UniValue test = tests[idx];
|
||||||
std::string strTest = test.write();
|
std::string strTest = test.write();
|
||||||
if (test.size() < 1) // Allow for extra stuff (useful for comments)
|
if (test.size() < 1) // Allow for extra stuff (useful for comments)
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(tx_valid)
|
|||||||
|
|
||||||
auto verifier = libzcash::ProofVerifier::Strict();
|
auto verifier = libzcash::ProofVerifier::Strict();
|
||||||
ScriptError err;
|
ScriptError err;
|
||||||
for (unsigned int idx = 0; idx < tests.size(); idx++) {
|
for (size_t idx = 0; idx < tests.size(); idx++) {
|
||||||
UniValue test = tests[idx];
|
UniValue test = tests[idx];
|
||||||
string strTest = test.write();
|
string strTest = test.write();
|
||||||
if (test[0].isArray())
|
if (test[0].isArray())
|
||||||
@@ -115,7 +115,7 @@ BOOST_AUTO_TEST_CASE(tx_valid)
|
|||||||
map<COutPoint, CScript> mapprevOutScriptPubKeys;
|
map<COutPoint, CScript> mapprevOutScriptPubKeys;
|
||||||
UniValue inputs = test[0].get_array();
|
UniValue inputs = test[0].get_array();
|
||||||
bool fValid = true;
|
bool fValid = true;
|
||||||
for (unsigned int inpIdx = 0; inpIdx < inputs.size(); inpIdx++) {
|
for (size_t inpIdx = 0; inpIdx < inputs.size(); inpIdx++) {
|
||||||
const UniValue& input = inputs[inpIdx];
|
const UniValue& input = inputs[inpIdx];
|
||||||
if (!input.isArray())
|
if (!input.isArray())
|
||||||
{
|
{
|
||||||
@@ -177,7 +177,7 @@ BOOST_AUTO_TEST_CASE(tx_invalid)
|
|||||||
|
|
||||||
auto verifier = libzcash::ProofVerifier::Strict();
|
auto verifier = libzcash::ProofVerifier::Strict();
|
||||||
ScriptError err;
|
ScriptError err;
|
||||||
for (unsigned int idx = 0; idx < tests.size(); idx++) {
|
for (size_t idx = 0; idx < tests.size(); idx++) {
|
||||||
UniValue test = tests[idx];
|
UniValue test = tests[idx];
|
||||||
string strTest = test.write();
|
string strTest = test.write();
|
||||||
if (test[0].isArray())
|
if (test[0].isArray())
|
||||||
@@ -191,7 +191,7 @@ BOOST_AUTO_TEST_CASE(tx_invalid)
|
|||||||
map<COutPoint, CScript> mapprevOutScriptPubKeys;
|
map<COutPoint, CScript> mapprevOutScriptPubKeys;
|
||||||
UniValue inputs = test[0].get_array();
|
UniValue inputs = test[0].get_array();
|
||||||
bool fValid = true;
|
bool fValid = true;
|
||||||
for (unsigned int inpIdx = 0; inpIdx < inputs.size(); inpIdx++) {
|
for (size_t inpIdx = 0; inpIdx < inputs.size(); inpIdx++) {
|
||||||
const UniValue& input = inputs[inpIdx];
|
const UniValue& input = inputs[inpIdx];
|
||||||
if (!input.isArray())
|
if (!input.isArray())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1005,7 +1005,7 @@ UniValue sendmany(const UniValue& params, bool fHelp)
|
|||||||
totalAmount += nAmount;
|
totalAmount += nAmount;
|
||||||
|
|
||||||
bool fSubtractFeeFromAmount = false;
|
bool fSubtractFeeFromAmount = false;
|
||||||
for (unsigned int idx = 0; idx < subtractFeeFromAmount.size(); idx++) {
|
for (size_t idx = 0; idx < subtractFeeFromAmount.size(); idx++) {
|
||||||
const UniValue& addr = subtractFeeFromAmount[idx];
|
const UniValue& addr = subtractFeeFromAmount[idx];
|
||||||
if (addr.get_str() == name_)
|
if (addr.get_str() == name_)
|
||||||
fSubtractFeeFromAmount = true;
|
fSubtractFeeFromAmount = true;
|
||||||
@@ -2130,7 +2130,7 @@ UniValue lockunspent(const UniValue& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
UniValue outputs = params[1].get_array();
|
UniValue outputs = params[1].get_array();
|
||||||
for (unsigned int idx = 0; idx < outputs.size(); idx++) {
|
for (size_t idx = 0; idx < outputs.size(); idx++) {
|
||||||
const UniValue& output = outputs[idx];
|
const UniValue& output = outputs[idx];
|
||||||
if (!output.isObject())
|
if (!output.isObject())
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected object");
|
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected object");
|
||||||
@@ -2354,7 +2354,7 @@ UniValue listunspent(const UniValue& params, bool fHelp)
|
|||||||
set<CBitcoinAddress> setAddress;
|
set<CBitcoinAddress> setAddress;
|
||||||
if (params.size() > 2) {
|
if (params.size() > 2) {
|
||||||
UniValue inputs = params[2].get_array();
|
UniValue inputs = params[2].get_array();
|
||||||
for (unsigned int idx = 0; idx < inputs.size(); idx++) {
|
for (size_t idx = 0; idx < inputs.size(); idx++) {
|
||||||
const UniValue& input = inputs[idx];
|
const UniValue& input = inputs[idx];
|
||||||
CBitcoinAddress address(input.get_str());
|
CBitcoinAddress address(input.get_str());
|
||||||
if (!address.IsValid())
|
if (!address.IsValid())
|
||||||
|
|||||||
Reference in New Issue
Block a user