Skip to content

Commit a715a64

Browse files
author
Jeff Garzik
committed
Merge branch 'rawtx' into merge-rawtx
2 parents e8cb5c3 + cbe39a3 commit a715a64

19 files changed

+1846
-182
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
src/bitcoin
55
src/bitcoind
66
src/bitcoin-cli
7+
src/bitcoin-tx
78
src/test/test_bitcoin
89
src/qt/test/test_bitcoin-qt
910

src/Makefile.am

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ LIBBITCOIN_COMMON=libbitcoin_common.a
3434
LIBBITCOIN_CLI=libbitcoin_cli.a
3535
LIBBITCOIN_UTIL=libbitcoin_util.a
3636
LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
37+
LIBBITCOIN_UNIVALUE=univalue/libbitcoin_univalue.a
3738
LIBBITCOINQT=qt/libbitcoinqt.a
3839

3940
noinst_LIBRARIES = \
4041
libbitcoin_server.a \
4142
libbitcoin_common.a \
4243
libbitcoin_cli.a \
4344
libbitcoin_util.a \
45+
univalue/libbitcoin_univalue.a \
4446
crypto/libbitcoin_crypto.a
4547
if ENABLE_WALLET
4648
BITCOIN_INCLUDES += $(BDB_CPPFLAGS)
@@ -58,6 +60,8 @@ if BUILD_BITCOIN_CLI
5860
bin_PROGRAMS += bitcoin-cli
5961
endif
6062

63+
bin_PROGRAMS += bitcoin-tx
64+
6165
.PHONY: FORCE
6266
# bitcoin core #
6367
BITCOIN_CORE_H = \
@@ -75,6 +79,7 @@ BITCOIN_CORE_H = \
7579
coins.h \
7680
compat.h \
7781
core.h \
82+
core_io.h \
7883
crypter.h \
7984
db.h \
8085
hash.h \
@@ -177,6 +182,13 @@ crypto_libbitcoin_crypto_a_SOURCES = \
177182
crypto/sha1.h \
178183
crypto/ripemd160.h
179184

185+
# univalue JSON library
186+
univalue_libbitcoin_univalue_a_SOURCES = \
187+
univalue/univalue.cpp \
188+
univalue/univalue_read.cpp \
189+
univalue/univalue_write.cpp \
190+
univalue/univalue.h
191+
180192
# common: shared between bitcoind, and bitcoin-qt and non-server tools
181193
libbitcoin_common_a_CPPFLAGS = $(BITCOIN_INCLUDES)
182194
libbitcoin_common_a_SOURCES = \
@@ -185,6 +197,8 @@ libbitcoin_common_a_SOURCES = \
185197
chainparams.cpp \
186198
coins.cpp \
187199
core.cpp \
200+
core_read.cpp \
201+
core_write.cpp \
188202
hash.cpp \
189203
key.cpp \
190204
keystore.cpp \
@@ -226,6 +240,7 @@ nodist_libbitcoin_util_a_SOURCES = $(srcdir)/obj/build.h
226240
bitcoind_LDADD = \
227241
$(LIBBITCOIN_SERVER) \
228242
$(LIBBITCOIN_COMMON) \
243+
$(LIBBITCOIN_UNIVALUE) \
229244
$(LIBBITCOIN_UTIL) \
230245
$(LIBBITCOIN_CRYPTO) \
231246
$(LIBLEVELDB) \
@@ -264,6 +279,17 @@ endif
264279
bitcoin_cli_CPPFLAGS = $(BITCOIN_INCLUDES)
265280
#
266281

282+
# bitcoin-tx binary #
283+
bitcoin_tx_LDADD = \
284+
$(LIBBITCOIN_UNIVALUE) \
285+
$(LIBBITCOIN_COMMON) \
286+
$(LIBBITCOIN_UTIL) \
287+
$(LIBBITCOIN_CRYPTO) \
288+
$(BOOST_LIBS)
289+
bitcoin_tx_SOURCES = bitcoin-tx.cpp
290+
bitcoin_tx_CPPFLAGS = $(BITCOIN_INCLUDES)
291+
#
292+
267293
if TARGET_WINDOWS
268294
bitcoin_cli_SOURCES += bitcoin-cli-res.rc
269295
endif

src/Makefile.qt.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ qt_bitcoin_qt_LDADD = qt/libbitcoinqt.a $(LIBBITCOIN_SERVER)
359359
if ENABLE_WALLET
360360
qt_bitcoin_qt_LDADD += $(LIBBITCOIN_WALLET)
361361
endif
362-
qt_bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBLEVELDB) $(LIBMEMENV) \
362+
qt_bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBBITCOIN_UNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \
363363
$(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS)
364364
if USE_LIBSECP256K1
365365
qt_bitcoin_qt_LDADD += secp256k1/libsecp256k1.la

src/Makefile.qttest.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ qt_test_test_bitcoin_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_SERVER)
3030
if ENABLE_WALLET
3131
qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_WALLET)
3232
endif
33-
qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBLEVELDB) \
33+
qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBBITCOIN_UNIVALUE) $(LIBLEVELDB) \
3434
$(LIBMEMENV) $(BOOST_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) \
3535
$(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS)
3636
if USE_LIBSECP256K1

src/Makefile.test.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ endif
6464

6565
test_test_bitcoin_SOURCES = $(BITCOIN_TESTS) $(JSON_TEST_FILES) $(RAW_TEST_FILES)
6666
test_test_bitcoin_CPPFLAGS = $(BITCOIN_INCLUDES) -I$(builddir)/test/ $(TESTDEFS)
67-
test_test_bitcoin_LDADD = $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBLEVELDB) $(LIBMEMENV) \
67+
test_test_bitcoin_LDADD = $(LIBBITCOIN_SERVER) $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBBITCOIN_UNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \
6868
$(BOOST_LIBS) $(BOOST_UNIT_TEST_FRAMEWORK_LIB)
6969
if ENABLE_WALLET
7070
test_test_bitcoin_LDADD += $(LIBBITCOIN_WALLET)

src/bitcoin-cli.cpp

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ static bool AppInitRPC(int argc, char* argv[])
5050
// Parameters
5151
//
5252
ParseParameters(argc, argv);
53-
if (!boost::filesystem::is_directory(GetDataDir(false)))
54-
{
53+
if (!boost::filesystem::is_directory(GetDataDir(false))) {
5554
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", mapArgs["-datadir"].c_str());
5655
return false;
5756
}
@@ -66,11 +65,9 @@ static bool AppInitRPC(int argc, char* argv[])
6665
fprintf(stderr, "Error: Invalid combination of -regtest and -testnet.\n");
6766
return false;
6867
}
69-
if (argc<2 || mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version"))
70-
{
68+
if (argc<2 || mapArgs.count("-?") || mapArgs.count("-help") || mapArgs.count("-version")) {
7169
std::string strUsage = _("Bitcoin Core RPC client version") + " " + FormatFullVersion() + "\n";
72-
if (!mapArgs.count("-version"))
73-
{
70+
if (!mapArgs.count("-version")) {
7471
strUsage += "\n" + _("Usage:") + "\n" +
7572
" bitcoin-cli [options] <command> [params] " + _("Send command to Bitcoin Core") + "\n" +
7673
" bitcoin-cli [options] help " + _("List commands") + "\n" +
@@ -153,11 +150,9 @@ int CommandLineRPC(int argc, char *argv[])
153150
{
154151
string strPrint;
155152
int nRet = 0;
156-
try
157-
{
153+
try {
158154
// Skip switches
159-
while (argc > 1 && IsSwitchChar(argv[1][0]))
160-
{
155+
while (argc > 1 && IsSwitchChar(argv[1][0])) {
161156
argc--;
162157
argv++;
163158
}
@@ -178,15 +173,12 @@ int CommandLineRPC(int argc, char *argv[])
178173
const Value& result = find_value(reply, "result");
179174
const Value& error = find_value(reply, "error");
180175

181-
if (error.type() != null_type)
182-
{
176+
if (error.type() != null_type) {
183177
// Error
184178
strPrint = "error: " + write_string(error, false);
185179
int code = find_value(error.get_obj(), "code").get_int();
186180
nRet = abs(code);
187-
}
188-
else
189-
{
181+
} else {
190182
// Result
191183
if (result.type() == null_type)
192184
strPrint = "";
@@ -208,8 +200,7 @@ int CommandLineRPC(int argc, char *argv[])
208200
throw;
209201
}
210202

211-
if (strPrint != "")
212-
{
203+
if (strPrint != "") {
213204
fprintf((nRet == 0 ? stdout : stderr), "%s\n", strPrint.c_str());
214205
}
215206
return nRet;
@@ -219,8 +210,7 @@ int main(int argc, char* argv[])
219210
{
220211
SetupEnvironment();
221212

222-
try
223-
{
213+
try {
224214
if(!AppInitRPC(argc, argv))
225215
return EXIT_FAILURE;
226216
}
@@ -233,8 +223,7 @@ int main(int argc, char* argv[])
233223
}
234224

235225
int ret = EXIT_FAILURE;
236-
try
237-
{
226+
try {
238227
ret = CommandLineRPC(argc, argv);
239228
}
240229
catch (std::exception& e) {

0 commit comments

Comments
 (0)