diff options
author | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-05-18 14:02:18 +0200 |
---|---|---|
committer | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-06-04 09:16:21 +0200 |
commit | 9a8897f4ac992741e153d88b54bd2cde877c713d (patch) | |
tree | e827981679708bae6bef1516d69efda3524b719f /src/rpcrawtransaction.cpp | |
parent | 3df0411ad9fd75fb27af53e44835d41f5480fe3f (diff) |
Remove JSON Spirit wrapper, remove JSON Spirit leftovers
- implement find_value() function for UniValue
- replace all Array/Value/Object types with UniValues, remove JSON Spirit to UniValue wrapper
- remove JSON Spirit sources
Diffstat (limited to 'src/rpcrawtransaction.cpp')
-rw-r--r-- | src/rpcrawtransaction.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index b4ddbfebf3..20394fc2c1 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -25,12 +25,12 @@ #include <stdint.h> #include <boost/assign/list_of.hpp> -#include "json_spirit_wrapper.h" -using namespace json_spirit; +#include "univalue/univalue.h" + using namespace std; -void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeHex) +void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex) { txnouttype type; vector<CTxDestination> addresses; @@ -54,7 +54,7 @@ void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeH out.push_back(Pair("addresses", a)); } -void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry) +void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry) { entry.push_back(Pair("txid", tx.GetHash().GetHex())); entry.push_back(Pair("version", tx.nVersion)); @@ -105,7 +105,7 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry) } } -UniValue getrawtransaction(const Array& params, bool fHelp) +UniValue getrawtransaction(const UniValue& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( @@ -195,7 +195,7 @@ UniValue getrawtransaction(const Array& params, bool fHelp) return result; } -UniValue gettxoutproof(const Array& params, bool fHelp) +UniValue gettxoutproof(const UniValue& params, bool fHelp) { if (fHelp || (params.size() != 1 && params.size() != 2)) throw runtime_error( @@ -221,7 +221,7 @@ UniValue gettxoutproof(const Array& params, bool fHelp) uint256 oneTxid; UniValue txids = params[0].get_array(); for (unsigned int idx = 0; idx < txids.size(); idx++) { - const Value& txid = txids[idx]; + const UniValue& 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())); @@ -276,7 +276,7 @@ UniValue gettxoutproof(const Array& params, bool fHelp) return strHex; } -UniValue verifytxoutproof(const Array& params, bool fHelp) +UniValue verifytxoutproof(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( @@ -309,7 +309,7 @@ UniValue verifytxoutproof(const Array& params, bool fHelp) return res; } -UniValue createrawtransaction(const Array& params, bool fHelp) +UniValue createrawtransaction(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 2) throw runtime_error( @@ -351,12 +351,12 @@ UniValue createrawtransaction(const Array& params, bool fHelp) CMutableTransaction rawTx; for (unsigned int idx = 0; idx < inputs.size(); idx++) { - const Value& input = inputs[idx]; - const Object& o = input.get_obj(); + const UniValue& input = inputs[idx]; + const UniValue& o = input.get_obj(); uint256 txid = ParseHashO(o, "txid"); - const Value& vout_v = find_value(o, "vout"); + const UniValue& vout_v = find_value(o, "vout"); if (!vout_v.isNum()) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing vout key"); int nOutput = vout_v.get_int(); @@ -388,7 +388,7 @@ UniValue createrawtransaction(const Array& params, bool fHelp) return EncodeHexTx(rawTx); } -UniValue decoderawtransaction(const Array& params, bool fHelp) +UniValue decoderawtransaction(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( @@ -453,7 +453,7 @@ UniValue decoderawtransaction(const Array& params, bool fHelp) return result; } -UniValue decodescript(const Array& params, bool fHelp) +UniValue decodescript(const UniValue& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( @@ -496,7 +496,7 @@ UniValue decodescript(const Array& params, bool fHelp) } /** Pushes a JSON object for script verification or signing errors to vErrorsRet. */ -static void TxInErrorToJSON(const CTxIn& txin, Array& vErrorsRet, const std::string& strMessage) +static void TxInErrorToJSON(const CTxIn& txin, UniValue& vErrorsRet, const std::string& strMessage) { UniValue entry(UniValue::VOBJ); entry.push_back(Pair("txid", txin.prevout.hash.ToString())); @@ -507,7 +507,7 @@ static void TxInErrorToJSON(const CTxIn& txin, Array& vErrorsRet, const std::str vErrorsRet.push_back(entry); } -UniValue signrawtransaction(const Array& params, bool fHelp) +UniValue signrawtransaction(const UniValue& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 4) throw runtime_error( @@ -639,7 +639,7 @@ UniValue signrawtransaction(const Array& params, bool fHelp) if (params.size() > 1 && !params[1].isNull()) { UniValue prevTxs = params[1].get_array(); for (unsigned int idx = 0; idx < prevTxs.size(); idx++) { - const Value& p = prevTxs[idx]; + const UniValue& p = prevTxs[idx]; if (!p.isObject()) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "expected object with {\"txid'\",\"vout\",\"scriptPubKey\"}"); @@ -749,7 +749,7 @@ UniValue signrawtransaction(const Array& params, bool fHelp) return result; } -UniValue sendrawtransaction(const Array& params, bool fHelp) +UniValue sendrawtransaction(const UniValue& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( |