Skip to content

Commit 9a8897f

Browse files
committed
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
1 parent 3df0411 commit 9a8897f

37 files changed

+212
-2202
lines changed

src/Makefile.am

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -154,17 +154,6 @@ BITCOIN_CORE_H = \
154154
wallet/wallet_ismine.h \
155155
wallet/walletdb.h
156156

157-
JSON_H = \
158-
json/json_spirit.h \
159-
json/json_spirit_error_position.h \
160-
json/json_spirit_reader.h \
161-
json/json_spirit_reader_template.h \
162-
json/json_spirit_stream_reader.h \
163-
json/json_spirit_utils.h \
164-
json/json_spirit_value.h \
165-
json/json_spirit_writer.h \
166-
json/json_spirit_writer_template.h
167-
168157
obj/build.h: FORCE
169158
@$(MKDIR_P) $(builddir)/obj
170159
@$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \
@@ -200,7 +189,6 @@ libbitcoin_server_a_SOURCES = \
200189
txdb.cpp \
201190
txmempool.cpp \
202191
validationinterface.cpp \
203-
$(JSON_H) \
204192
$(BITCOIN_CORE_H)
205193

206194
# wallet: shared between bitcoind and bitcoin-qt, but only linked

src/bitcoin-cli.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212

1313
#include <boost/filesystem/operations.hpp>
1414

15+
#include "univalue/univalue.h"
16+
1517
using namespace std;
16-
using namespace json_spirit;
1718

1819
std::string HelpMessageCli()
1920
{
@@ -94,7 +95,7 @@ static bool AppInitRPC(int argc, char* argv[])
9495
return true;
9596
}
9697

97-
UniValue CallRPC(const string& strMethod, const Array& params)
98+
UniValue CallRPC(const string& strMethod, const UniValue& params)
9899
{
99100
if (mapArgs["-rpcuser"] == "" && mapArgs["-rpcpassword"] == "")
100101
throw runtime_error(strprintf(
@@ -145,7 +146,7 @@ UniValue CallRPC(const string& strMethod, const Array& params)
145146
UniValue valReply(UniValue::VSTR);
146147
if (!valReply.read(strReply))
147148
throw runtime_error("couldn't parse reply from server");
148-
const Object& reply = valReply.get_obj();
149+
const UniValue& reply = valReply.get_obj();
149150
if (reply.empty())
150151
throw runtime_error("expected reply to have result, error and id properties");
151152

@@ -179,13 +180,15 @@ int CommandLineRPC(int argc, char *argv[])
179180
const UniValue reply = CallRPC(strMethod, params);
180181

181182
// Parse reply
182-
const Value& result = find_value(reply, "result");
183-
const Value& error = find_value(reply, "error");
183+
const UniValue& result = find_value(reply, "result");
184+
const UniValue& error = find_value(reply, "error");
184185

185186
if (!error.isNull()) {
186187
// Error
187-
strPrint = "error: " + error.write();
188188
int code = error["code"].get_int();
189+
if (fWait && code == RPC_IN_WARMUP)
190+
throw CConnectionFailed("server in warmup");
191+
strPrint = "error: " + error.write();
189192
nRet = abs(code);
190193
} else {
191194
// Result

src/json/LICENSE.txt

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/json/json_spirit.h

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/json/json_spirit_error_position.h

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/json/json_spirit_reader.cpp

Lines changed: 0 additions & 137 deletions
This file was deleted.

src/json/json_spirit_reader.h

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)