remove JSON Spirit UniValue wrapper

This commit is contained in:
Jonas Schnelli
2015-05-13 21:29:19 +02:00
committed by Jack Grigg
parent 565d26737a
commit 851f58f94e
23 changed files with 255 additions and 274 deletions

View File

@@ -164,7 +164,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry)
}
}
Value getrawtransaction(const Array& params, bool fHelp)
UniValue getrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
@@ -281,7 +281,7 @@ Value getrawtransaction(const Array& params, bool fHelp)
return result;
}
Value gettxoutproof(const Array& params, bool fHelp)
UniValue gettxoutproof(const Array& params, bool fHelp)
{
if (fHelp || (params.size() != 1 && params.size() != 2))
throw runtime_error(
@@ -305,7 +305,7 @@ Value gettxoutproof(const Array& params, bool fHelp)
set<uint256> setTxids;
uint256 oneTxid;
Array txids = params[0].get_array();
UniValue txids = params[0].get_array();
for (unsigned int idx = 0; idx < txids.size(); idx++) {
const Value& txid = txids[idx];
if (txid.get_str().length() != 64 || !IsHex(txid.get_str()))
@@ -362,7 +362,7 @@ Value gettxoutproof(const Array& params, bool fHelp)
return strHex;
}
Value verifytxoutproof(const Array& params, bool fHelp)
UniValue verifytxoutproof(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
@@ -395,7 +395,7 @@ Value verifytxoutproof(const Array& params, bool fHelp)
return res;
}
Value createrawtransaction(const Array& params, bool fHelp)
UniValue createrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 2)
throw runtime_error(
@@ -431,8 +431,8 @@ Value createrawtransaction(const Array& params, bool fHelp)
LOCK(cs_main);
RPCTypeCheck(params, boost::assign::list_of(UniValue::VARR)(UniValue::VOBJ));
Array inputs = params[0].get_array();
Object sendTo = params[1].get_obj();
UniValue inputs = params[0].get_array();
UniValue sendTo = params[1].get_obj();
CMutableTransaction rawTx;
@@ -474,7 +474,7 @@ Value createrawtransaction(const Array& params, bool fHelp)
return EncodeHexTx(rawTx);
}
Value decoderawtransaction(const Array& params, bool fHelp)
UniValue decoderawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
@@ -566,7 +566,7 @@ Value decoderawtransaction(const Array& params, bool fHelp)
return result;
}
Value decodescript(const Array& params, bool fHelp)
UniValue decodescript(const Array& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
@@ -620,7 +620,7 @@ static void TxInErrorToJSON(const CTxIn& txin, Array& vErrorsRet, const std::str
vErrorsRet.push_back(entry);
}
Value signrawtransaction(const Array& params, bool fHelp)
UniValue signrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 4)
throw runtime_error(
@@ -730,9 +730,9 @@ Value signrawtransaction(const Array& params, bool fHelp)
CBasicKeyStore tempKeystore;
if (params.size() > 2 && !params[2].isNull()) {
fGivenKeys = true;
Array keys = params[2].get_array();
UniValue keys = params[2].get_array();
for (unsigned int idx = 0; idx < keys.size(); idx++) {
Value k = keys[idx];
UniValue k = keys[idx];
CBitcoinSecret vchSecret;
bool fGood = vchSecret.SetString(k.get_str());
if (!fGood)
@@ -750,13 +750,13 @@ Value signrawtransaction(const Array& params, bool fHelp)
// Add previous txouts given in the RPC call:
if (params.size() > 1 && !params[1].isNull()) {
Array prevTxs = params[1].get_array();
UniValue prevTxs = params[1].get_array();
for (unsigned int idx = 0; idx < prevTxs.size(); idx++) {
const Value& p = prevTxs[idx];
if (!p.isObject())
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "expected object with {\"txid'\",\"vout\",\"scriptPubKey\"}");
Object prevOut = p.get_obj();
UniValue prevOut = p.get_obj();
RPCTypeCheckObj(prevOut, boost::assign::map_list_of("txid", UniValue::VSTR)("vout", UniValue::VNUM)("scriptPubKey", UniValue::VSTR));
@@ -787,7 +787,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
// given), add redeemScript to the tempKeystore so it can be signed:
if (fGivenKeys && scriptPubKey.IsPayToScriptHash()) {
RPCTypeCheckObj(prevOut, boost::assign::map_list_of("txid", UniValue::VSTR)("vout", UniValue::VNUM)("scriptPubKey", UniValue::VSTR)("redeemScript",UniValue::VSTR));
Value v = find_value(prevOut, "redeemScript");
UniValue v = find_value(prevOut, "redeemScript");
if (!v.isNull()) {
vector<unsigned char> rsData(ParseHexV(v, "redeemScript"));
CScript redeemScript(rsData.begin(), rsData.end());
@@ -862,7 +862,7 @@ Value signrawtransaction(const Array& params, bool fHelp)
return result;
}
Value sendrawtransaction(const Array& params, bool fHelp)
UniValue sendrawtransaction(const Array& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(