aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am1
-rw-r--r--src/bitcoin-cli.cpp2
-rw-r--r--src/rest.cpp9
-rw-r--r--src/rpcblockchain.cpp4
-rw-r--r--src/rpcclient.cpp2
-rw-r--r--src/rpcmining.cpp4
-rw-r--r--src/rpcmisc.cpp4
-rw-r--r--src/rpcprotocol.cpp6
-rw-r--r--src/rpcrawtransaction.cpp7
-rw-r--r--src/test/script_tests.cpp14
-rw-r--r--src/test/transaction_tests.cpp1
-rw-r--r--src/wallet/rpcdump.cpp10
-rw-r--r--src/wallet/rpcwallet.cpp81
13 files changed, 76 insertions, 69 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 63332f9acd..5041ae2f1c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -98,6 +98,7 @@ BITCOIN_CORE_H = \
ecwrapper.h \
hash.h \
init.h \
+ json_spirit_wrapper.h \
key.h \
keystore.h \
leveldbwrapper.h \
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index 9950153a65..9ad5fb6b1d 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -142,7 +142,7 @@ Object CallRPC(const string& strMethod, const Array& params)
throw runtime_error("no response from server");
// Parse reply
- Value valReply;
+ Value valReply(UniValue::VSTR);
if (!valReply.read(strReply))
throw runtime_error("couldn't parse reply from server");
const Object& reply = valReply.get_obj();
diff --git a/src/rest.cpp b/src/rest.cpp
index 7c238d506d..5f64a0091c 100644
--- a/src/rest.cpp
+++ b/src/rest.cpp
@@ -222,7 +222,7 @@ static bool rest_block(AcceptedConnection* conn,
case RF_JSON: {
Object objBlock = blockToJSON(block, pblockindex, showTxDetails);
- string strJSON = write_string(Value(objBlock), false) + "\n";
+ string strJSON = objBlock.write() + "\n";
conn->stream() << HTTPReply(HTTP_OK, strJSON, fRun) << std::flush;
return true;
}
@@ -267,8 +267,7 @@ static bool rest_chaininfo(AcceptedConnection* conn,
case RF_JSON: {
Array rpcParams;
Value chainInfoObject = getblockchaininfo(rpcParams, false);
-
- string strJSON = write_string(chainInfoObject, false) + "\n";
+ string strJSON = chainInfoObject.write() + "\n";
conn->stream() << HTTPReply(HTTP_OK, strJSON, fRun) << std::flush;
return true;
}
@@ -319,7 +318,7 @@ static bool rest_tx(AcceptedConnection* conn,
case RF_JSON: {
Object objTx;
TxToJSON(tx, hashBlock, objTx);
- string strJSON = write_string(Value(objTx), false) + "\n";
+ string strJSON = objTx.write() + "\n";
conn->stream() << HTTPReply(HTTP_OK, strJSON, fRun) << std::flush;
return true;
}
@@ -516,7 +515,7 @@ static bool rest_getutxos(AcceptedConnection* conn,
objGetUTXOResponse.push_back(Pair("utxos", utxos));
// return json string
- string strJSON = write_string(Value(objGetUTXOResponse), false) + "\n";
+ string strJSON = objGetUTXOResponse.write() + "\n";
conn->stream() << HTTPReply(HTTP_OK, strJSON, fRun) << std::flush;
return true;
}
diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp
index 2f9fd5e045..55403c9e82 100644
--- a/src/rpcblockchain.cpp
+++ b/src/rpcblockchain.cpp
@@ -678,7 +678,7 @@ Value invalidateblock(const Array& params, bool fHelp)
throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason());
}
- return Value::null;
+ return NullUniValue;
}
Value reconsiderblock(const Array& params, bool fHelp)
@@ -717,5 +717,5 @@ Value reconsiderblock(const Array& params, bool fHelp)
throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason());
}
- return Value::null;
+ return NullUniValue;
}
diff --git a/src/rpcclient.cpp b/src/rpcclient.cpp
index d8c4da4207..8b7b9e1493 100644
--- a/src/rpcclient.cpp
+++ b/src/rpcclient.cpp
@@ -122,7 +122,7 @@ static CRPCConvertTable rpcCvtTable;
/** Convert strings to command-specific RPC representation */
Array RPCConvertValues(const std::string &strMethod, const std::vector<std::string> &strParams)
{
- Array params;
+ UniValue params(UniValue::VARR);
for (unsigned int idx = 0; idx < strParams.size(); idx++) {
const std::string& strVal = strParams[idx];
diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp
index 4571269c3f..95b788810e 100644
--- a/src/rpcmining.cpp
+++ b/src/rpcmining.cpp
@@ -399,7 +399,7 @@ Value getblocktemplate(const Array& params, bool fHelp)
if (strMode == "proposal")
{
const Value& dataval = find_value(oparam, "data");
- if (dataval.type() != str_type)
+ if (dataval.isStr())
throw JSONRPCError(RPC_TYPE_ERROR, "Missing data String key for proposal");
CBlock block;
@@ -519,7 +519,7 @@ Value getblocktemplate(const Array& params, bool fHelp)
UpdateTime(pblock, Params().GetConsensus(), pindexPrev);
pblock->nNonce = 0;
- static const Array aCaps = boost::assign::list_of("proposal");
+ Array aCaps; aCaps.push_back("proposal");
Array transactions;
map<uint256, int64_t> setTxIndex;
diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp
index f7bd3e0d5a..b06408f21e 100644
--- a/src/rpcmisc.cpp
+++ b/src/rpcmisc.cpp
@@ -389,8 +389,8 @@ Value setmocktime(const Array& params, bool fHelp)
LOCK(cs_main);
- RPCTypeCheck(params, boost::assign::list_of(int_type));
+ RPCTypeCheck(params, boost::assign::list_of(UniValue::VNUM));
SetMockTime(params[0].get_int64());
- return Value::null;
+ return NullUniValue;
}
diff --git a/src/rpcprotocol.cpp b/src/rpcprotocol.cpp
index 72a7b76343..9b422894ef 100644
--- a/src/rpcprotocol.cpp
+++ b/src/rpcprotocol.cpp
@@ -256,7 +256,7 @@ int ReadHTTPMessage(std::basic_istream<char>& stream, map<string,
string JSONRPCRequest(const string& strMethod, const Array& params, const Value& id)
{
- Object request;
+ Object request(UniValue::VOBJ);
request.push_back(Pair("method", strMethod));
request.push_back(Pair("params", params));
request.push_back(Pair("id", id));
@@ -265,7 +265,7 @@ string JSONRPCRequest(const string& strMethod, const Array& params, const Value&
Object JSONRPCReplyObj(const Value& result, const Value& error, const Value& id)
{
- Object reply;
+ Object reply(UniValue::VOBJ);
if (!error.isNull())
reply.push_back(Pair("result", NullUniValue));
else
@@ -283,7 +283,7 @@ string JSONRPCReply(const Value& result, const Value& error, const Value& id)
Object JSONRPCError(int code, const string& message)
{
- Object error;
+ UniValue error(UniValue::VOBJ);
error.push_back(Pair("code", code));
error.push_back(Pair("message", message));
return error;
diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp
index 8d2b035f31..fe357d341f 100644
--- a/src/rpcrawtransaction.cpp
+++ b/src/rpcrawtransaction.cpp
@@ -220,7 +220,8 @@ Value gettxoutproof(const Array& params, bool fHelp)
set<uint256> setTxids;
uint256 oneTxid;
Array txids = params[0].get_array();
- BOOST_FOREACH(Value& txid, txids) {
+ for (unsigned int idx = 0; idx < txids.size(); idx++) {
+ const Value& txid = txids[idx];
if (txid.get_str().length() != 64 || !IsHex(txid.get_str()))
throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid txid ")+txid.get_str());
uint256 hash(uint256S(txid.get_str()));
@@ -446,7 +447,7 @@ Value decoderawtransaction(const Array& params, bool fHelp)
if (!DecodeHexTx(tx, params[0].get_str()))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
- Object result;
+ UniValue result(UniValue::VOBJ);
TxToJSON(tx, uint256(), result);
return result;
@@ -478,7 +479,7 @@ Value decodescript(const Array& params, bool fHelp)
);
LOCK(cs_main);
- RPCTypeCheck(params, boost::assign::list_of(str_type));
+ RPCTypeCheck(params, boost::assign::list_of(UniValue::VSTR));
Object r;
CScript script;
diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp
index b4cab3245c..989b35b9e8 100644
--- a/src/test/script_tests.cpp
+++ b/src/test/script_tests.cpp
@@ -583,11 +583,13 @@ BOOST_AUTO_TEST_CASE(script_build)
Array json_good = read_json(std::string(json_tests::script_valid, json_tests::script_valid + sizeof(json_tests::script_valid)));
Array json_bad = read_json(std::string(json_tests::script_invalid, json_tests::script_invalid + sizeof(json_tests::script_invalid)));
- BOOST_FOREACH(Value& tv, json_good) {
- tests_good.insert(write_string(Value(tv.get_array()), true));
+ for (unsigned int idx = 0; idx < json_good.size(); idx++) {
+ const Value& tv = json_good[idx];
+ tests_good.insert(tv.get_array().write());
}
- BOOST_FOREACH(Value& tv, json_bad) {
- tests_bad.insert(write_string(Value(tv.get_array()), true));
+ for (unsigned int idx = 0; idx < json_bad.size(); idx++) {
+ const Value& tv = json_bad[idx];
+ tests_bad.insert(tv.get_array().write());
}
}
@@ -596,7 +598,7 @@ BOOST_AUTO_TEST_CASE(script_build)
BOOST_FOREACH(TestBuilder& test, good) {
test.Test(true);
- std::string str = write_string(Value(test.GetJSON()), true);
+ std::string str = test.GetJSON().write();
#ifndef UPDATE_JSON_TESTS
if (tests_good.count(str) == 0) {
BOOST_CHECK_MESSAGE(false, "Missing auto script_valid test: " + test.GetComment());
@@ -606,7 +608,7 @@ BOOST_AUTO_TEST_CASE(script_build)
}
BOOST_FOREACH(TestBuilder& test, bad) {
test.Test(false);
- std::string str = write_string(Value(test.GetJSON()), true);
+ std::string str = test.GetJSON().write();
#ifndef UPDATE_JSON_TESTS
if (tests_bad.count(str) == 0) {
BOOST_CHECK_MESSAGE(false, "Missing auto script_invalid test: " + test.GetComment());
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp
index cdd88f348d..0ddc48271b 100644
--- a/src/test/transaction_tests.cpp
+++ b/src/test/transaction_tests.cpp
@@ -20,6 +20,7 @@
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
+#include <boost/assign/list_of.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/assign/list_of.hpp>
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index 68d2a21c47..e0cccef696 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -73,7 +73,7 @@ std::string DecodeDumpString(const std::string &str) {
Value importprivkey(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() < 1 || params.size() > 3)
throw runtime_error(
@@ -147,7 +147,7 @@ Value importprivkey(const Array& params, bool fHelp)
Value importaddress(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() < 1 || params.size() > 3)
throw runtime_error(
@@ -220,7 +220,7 @@ Value importaddress(const Array& params, bool fHelp)
Value importwallet(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() != 1)
throw runtime_error(
@@ -324,7 +324,7 @@ Value importwallet(const Array& params, bool fHelp)
Value dumpprivkey(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() != 1)
throw runtime_error(
@@ -362,7 +362,7 @@ Value dumpprivkey(const Array& params, bool fHelp)
Value dumpwallet(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() != 1)
throw runtime_error(
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index e743b1fa1d..f24a37ae6c 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -89,7 +89,7 @@ string AccountFromValue(const Value& value)
Value getnewaddress(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() > 1)
throw runtime_error(
@@ -168,7 +168,7 @@ CBitcoinAddress GetAccountAddress(string strAccount, bool bForceNew=false)
Value getaccountaddress(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() != 1)
throw runtime_error(
@@ -200,7 +200,7 @@ Value getaccountaddress(const Array& params, bool fHelp)
Value getrawchangeaddress(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() > 1)
throw runtime_error(
@@ -235,7 +235,7 @@ Value getrawchangeaddress(const Array& params, bool fHelp)
Value setaccount(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
@@ -281,7 +281,7 @@ Value setaccount(const Array& params, bool fHelp)
Value getaccount(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() != 1)
throw runtime_error(
@@ -313,7 +313,7 @@ Value getaccount(const Array& params, bool fHelp)
Value getaddressesbyaccount(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() != 1)
throw runtime_error(
@@ -381,7 +381,7 @@ static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtr
Value sendtoaddress(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() < 2 || params.size() > 5)
throw runtime_error(
@@ -437,7 +437,7 @@ Value sendtoaddress(const Array& params, bool fHelp)
Value listaddressgroupings(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp)
throw runtime_error(
@@ -489,7 +489,7 @@ Value listaddressgroupings(const Array& params, bool fHelp)
Value signmessage(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() != 2)
throw runtime_error(
@@ -545,7 +545,7 @@ Value signmessage(const Array& params, bool fHelp)
Value getreceivedbyaddress(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
@@ -603,7 +603,7 @@ Value getreceivedbyaddress(const Array& params, bool fHelp)
Value getreceivedbyaccount(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
@@ -692,7 +692,7 @@ CAmount GetAccountBalance(const string& strAccount, int nMinDepth, const isminef
Value getbalance(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() > 3)
throw runtime_error(
@@ -767,7 +767,7 @@ Value getbalance(const Array& params, bool fHelp)
Value getunconfirmedbalance(const Array &params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() > 0)
throw runtime_error(
@@ -783,7 +783,7 @@ Value getunconfirmedbalance(const Array &params, bool fHelp)
Value movecmd(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() < 3 || params.size() > 5)
throw runtime_error(
@@ -853,7 +853,7 @@ Value movecmd(const Array& params, bool fHelp)
Value sendfrom(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() < 3 || params.size() > 6)
throw runtime_error(
@@ -916,7 +916,7 @@ Value sendfrom(const Array& params, bool fHelp)
Value sendmany(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() < 2 || params.size() > 5)
throw runtime_error(
@@ -991,9 +991,11 @@ Value sendmany(const Array& params, bool fHelp)
totalAmount += nAmount;
bool fSubtractFeeFromAmount = false;
- BOOST_FOREACH(const Value& addr, subtractFeeFromAmount)
- if (addr.get_str() == s.name_)
+ for (unsigned int idx = 0; idx < subtractFeeFromAmount.size(); idx++) {
+ const Value& addr = subtractFeeFromAmount[idx];
+ if (addr.get_str() == name_)
fSubtractFeeFromAmount = true;
+ }
CRecipient recipient = {scriptPubKey, nAmount, fSubtractFeeFromAmount};
vecSend.push_back(recipient);
@@ -1026,7 +1028,7 @@ extern CScript _createmultisig_redeemScript(const Array& params);
Value addmultisigaddress(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() < 2 || params.size() > 3)
{
@@ -1207,7 +1209,7 @@ Value ListReceived(const Array& params, bool fByAccounts)
Value listreceivedbyaddress(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() > 3)
throw runtime_error(
@@ -1244,7 +1246,7 @@ Value listreceivedbyaddress(const Array& params, bool fHelp)
Value listreceivedbyaccount(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() > 3)
throw runtime_error(
@@ -1374,7 +1376,7 @@ void AcentryToJSON(const CAccountingEntry& acentry, const string& strAccount, Ar
Value listtransactions(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() > 4)
throw runtime_error(
@@ -1494,7 +1496,7 @@ Value listtransactions(const Array& params, bool fHelp)
Value listaccounts(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() > 2)
throw runtime_error(
@@ -1574,7 +1576,7 @@ Value listaccounts(const Array& params, bool fHelp)
Value listsinceblock(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp)
throw runtime_error(
@@ -1665,7 +1667,7 @@ Value listsinceblock(const Array& params, bool fHelp)
Value gettransaction(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
@@ -1743,7 +1745,7 @@ Value gettransaction(const Array& params, bool fHelp)
Value backupwallet(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() != 1)
throw runtime_error(
@@ -1769,7 +1771,7 @@ Value backupwallet(const Array& params, bool fHelp)
Value keypoolrefill(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() > 1)
throw runtime_error(
@@ -1813,7 +1815,7 @@ static void LockWallet(CWallet* pWallet)
Value walletpassphrase(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (pwalletMain->IsCrypted() && (fHelp || params.size() != 2))
throw runtime_error(
@@ -1873,7 +1875,7 @@ Value walletpassphrase(const Array& params, bool fHelp)
Value walletpassphrasechange(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (pwalletMain->IsCrypted() && (fHelp || params.size() != 2))
throw runtime_error(
@@ -1919,7 +1921,7 @@ Value walletpassphrasechange(const Array& params, bool fHelp)
Value walletlock(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (pwalletMain->IsCrypted() && (fHelp || params.size() != 0))
throw runtime_error(
@@ -1958,7 +1960,7 @@ Value walletlock(const Array& params, bool fHelp)
Value encryptwallet(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (!pwalletMain->IsCrypted() && (fHelp || params.size() != 1))
throw runtime_error(
@@ -2015,7 +2017,7 @@ Value encryptwallet(const Array& params, bool fHelp)
Value lockunspent(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
@@ -2099,7 +2101,7 @@ Value lockunspent(const Array& params, bool fHelp)
Value listlockunspent(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() > 0)
throw runtime_error(
@@ -2148,7 +2150,7 @@ Value listlockunspent(const Array& params, bool fHelp)
Value settxfee(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() < 1 || params.size() > 1)
throw runtime_error(
@@ -2177,7 +2179,7 @@ Value settxfee(const Array& params, bool fHelp)
Value getwalletinfo(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() != 0)
throw runtime_error(
@@ -2217,7 +2219,7 @@ Value getwalletinfo(const Array& params, bool fHelp)
Value resendwallettransactions(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() != 0)
throw runtime_error(
@@ -2242,7 +2244,7 @@ Value resendwallettransactions(const Array& params, bool fHelp)
Value listunspent(const Array& params, bool fHelp)
{
if (!EnsureWalletIsAvailable(fHelp))
- return Value::null;
+ return NullUniValue;
if (fHelp || params.size() > 3)
throw runtime_error(
@@ -2280,7 +2282,7 @@ Value listunspent(const Array& params, bool fHelp)
+ HelpExampleRpc("listunspent", "6, 9999999 \"[\\\"1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\",\\\"1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\"]\"")
);
- RPCTypeCheck(params, boost::assign::list_of(int_type)(int_type)(array_type));
+ RPCTypeCheck(params, boost::assign::list_of(UniValue::VNUM)(UniValue::VNUM)(UniValue::VARR));
int nMinDepth = 1;
if (params.size() > 0)
@@ -2293,7 +2295,8 @@ Value listunspent(const Array& params, bool fHelp)
set<CBitcoinAddress> setAddress;
if (params.size() > 2) {
Array inputs = params[2].get_array();
- BOOST_FOREACH(Value& input, inputs) {
+ for (unsigned int idx = 0; idx < inputs.size(); idx++) {
+ const Value& input = inputs[idx];
CBitcoinAddress address(input.get_str());
if (!address.IsValid())
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Bitcoin address: ")+input.get_str());