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
This commit is contained in:
Jonas Schnelli
2015-05-18 14:02:18 +02:00
committed by Jack Grigg
parent 851f58f94e
commit d014114d67
37 changed files with 212 additions and 2209 deletions

View File

@@ -13,13 +13,12 @@
#include <stdint.h>
#include "json_spirit_wrapper.h"
#include "univalue/univalue.h"
using namespace json_spirit;
using namespace std;
extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry);
void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeHex);
extern void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry);
void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex);
double GetDifficultyINTERNAL(const CBlockIndex* blockindex, bool networkDifficulty)
{
@@ -116,7 +115,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
}
UniValue getblockcount(const Array& params, bool fHelp)
UniValue getblockcount(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
@@ -133,7 +132,7 @@ UniValue getblockcount(const Array& params, bool fHelp)
return chainActive.Height();
}
UniValue getbestblockhash(const Array& params, bool fHelp)
UniValue getbestblockhash(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
@@ -150,7 +149,7 @@ UniValue getbestblockhash(const Array& params, bool fHelp)
return chainActive.Tip()->GetBlockHash().GetHex();
}
UniValue getdifficulty(const Array& params, bool fHelp)
UniValue getdifficulty(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
@@ -168,7 +167,7 @@ UniValue getdifficulty(const Array& params, bool fHelp)
}
UniValue getrawmempool(const Array& params, bool fHelp)
UniValue getrawmempool(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() > 1)
throw runtime_error(
@@ -253,7 +252,7 @@ UniValue getrawmempool(const Array& params, bool fHelp)
}
}
UniValue getblockhash(const Array& params, bool fHelp)
UniValue getblockhash(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
@@ -278,7 +277,7 @@ UniValue getblockhash(const Array& params, bool fHelp)
return pblockindex->GetBlockHash().GetHex();
}
UniValue getblock(const Array& params, bool fHelp)
UniValue getblock(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
@@ -346,7 +345,7 @@ UniValue getblock(const Array& params, bool fHelp)
return blockToJSON(block, pblockindex);
}
UniValue gettxoutsetinfo(const Array& params, bool fHelp)
UniValue gettxoutsetinfo(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
@@ -386,7 +385,7 @@ UniValue gettxoutsetinfo(const Array& params, bool fHelp)
return ret;
}
UniValue gettxout(const Array& params, bool fHelp)
UniValue gettxout(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() < 2 || params.size() > 3)
throw runtime_error(
@@ -466,7 +465,7 @@ UniValue gettxout(const Array& params, bool fHelp)
return ret;
}
UniValue verifychain(const Array& params, bool fHelp)
UniValue verifychain(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() > 2)
throw runtime_error(
@@ -524,7 +523,7 @@ Object SoftForkDesc(const std::string &name, int version, CBlockIndex* pindex, c
return rv;
}
UniValue getblockchaininfo(const Array& params, bool fHelp)
UniValue getblockchaininfo(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
@@ -609,7 +608,7 @@ struct CompareBlocksByHeight
}
};
UniValue getchaintips(const Array& params, bool fHelp)
UniValue getchaintips(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
@@ -699,7 +698,7 @@ UniValue getchaintips(const Array& params, bool fHelp)
return res;
}
UniValue getmempoolinfo(const Array& params, bool fHelp)
UniValue getmempoolinfo(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 0)
throw runtime_error(
@@ -722,7 +721,7 @@ UniValue getmempoolinfo(const Array& params, bool fHelp)
return ret;
}
UniValue invalidateblock(const Array& params, bool fHelp)
UniValue invalidateblock(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(
@@ -760,7 +759,7 @@ UniValue invalidateblock(const Array& params, bool fHelp)
return NullUniValue;
}
UniValue reconsiderblock(const Array& params, bool fHelp)
UniValue reconsiderblock(const UniValue& params, bool fHelp)
{
if (fHelp || params.size() != 1)
throw runtime_error(