diff --git a/.gitmodules b/.gitmodules index d586dadaf..cedab2e4d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "daemon/jsmn"] path = daemon/jsmn url = https://github.com/zserge/jsmn +[submodule "bitcoin/libbase58"] + path = bitcoin/libbase58 + url = https://github.com/bitcoin/libbase58.git diff --git a/Makefile b/Makefile index 099b97256..c952ad596 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,10 @@ BITCOIN_SRC := \ BITCOIN_OBJS := $(BITCOIN_SRC:.c=.o) +LIBBASE58_SRC := bitcoin/libbase58/base58.c + +LIBBASE58_OBJS := $(LIBBASE58_SRC:.c=.o) + CORE_SRC := \ close_tx.c \ find_p2sh_out.c \ @@ -163,6 +167,8 @@ BITCOIN_HEADERS := bitcoin/address.h \ bitcoin/tx.h \ bitcoin/varint.h +LIBBASE58_HEADERS := bitcoin/libbase58/libbase58.h + CORE_HEADERS := close_tx.h \ find_p2sh_out.h \ irc.h \ @@ -196,7 +202,7 @@ CWARNFLAGS := -Werror -Wall -Wundef -Wmissing-prototypes -Wmissing-declarations CDEBUGFLAGS := -g -fstack-protector CFLAGS := $(CWARNFLAGS) $(CDEBUGFLAGS) -I $(CCANDIR) -I secp256k1/include/ -I . $(FEATURES) -LDLIBS := -lprotobuf-c -lgmp -lsodium -lbase58 -lsqlite3 +LDLIBS := -lprotobuf-c -lgmp -lsodium -lsqlite3 $(PROGRAMS): CFLAGS+=-I. default: $(PROGRAMS) $(MANPAGES) daemon-all @@ -208,10 +214,10 @@ $(MANPAGES): doc/%: doc/%.txt @if $(CHANGED_FROM_GIT); then echo a2x --format=manpage $<; a2x --format=manpage $<; else touch $@; fi # Everything depends on the CCAN headers. -$(CCAN_OBJS) $(CDUMP_OBJS) $(HELPER_OBJS) $(BITCOIN_OBJS) $(TEST_PROGRAMS:=.o) ccan/ccan/cdump/tools/cdump-enumstr.o: $(CCAN_HEADERS) +$(CCAN_OBJS) $(CDUMP_OBJS) $(HELPER_OBJS) $(BITCOIN_OBJS) $(LIBBASE58_OBJS) $(TEST_PROGRAMS:=.o) ccan/ccan/cdump/tools/cdump-enumstr.o: $(CCAN_HEADERS) # Except for CCAN, everything depends on bitcoin/ and core headers. -$(HELPER_OBJS) $(CORE_OBJS) $(BITCOIN_OBJS) $(TEST_PROGRAMS:=.o): $(BITCOIN_HEADERS) $(CORE_HEADERS) $(CCAN_HEADERS) $(GEN_HEADERS) +$(HELPER_OBJS) $(CORE_OBJS) $(BITCOIN_OBJS) $(LIBBASE58_OBJS) $(TEST_PROGRAMS:=.o): $(BITCOIN_HEADERS) $(CORE_HEADERS) $(CCAN_HEADERS) $(GEN_HEADERS) test-protocol: test/test_protocol set -e; TMP=`mktemp`; for f in test/commits/*.script; do if ! $(VALGRIND) test/test_protocol < $$f > $$TMP; then echo "test/test_protocol < $$f FAILED" >&2; exit 1; fi; diff -u $$TMP $$f.expected; done; rm $$TMP @@ -285,7 +291,7 @@ secp256k1/libsecp256k1.la: lightning.pb-c.c lightning.pb-c.h: lightning.proto @if $(CHANGED_FROM_GIT); then echo $(PROTOCC) lightning.proto --c_out=.; $(PROTOCC) lightning.proto --c_out=.; else touch $@; fi -$(TEST_PROGRAMS): % : %.o $(BITCOIN_OBJS) $(WIRE_OBJS) $(CCAN_OBJS) utils.o version.o libsecp256k1.a +$(TEST_PROGRAMS): % : %.o $(BITCOIN_OBJS) $(LIBBASE58_OBJS) $(WIRE_OBJS) $(CCAN_OBJS) utils.o version.o libsecp256k1.a ccan/config.h: ccan/tools/configurator/configurator if $< > $@.new; then mv $@.new $@; else rm $@.new; exit 1; fi diff --git a/bitcoin/base58.c b/bitcoin/base58.c index d45c906af..665fffef8 100644 --- a/bitcoin/base58.c +++ b/bitcoin/base58.c @@ -9,10 +9,10 @@ #include "pubkey.h" #include "shadouble.h" #include "utils.h" +#include "libbase58/libbase58.h" #include #include #include -#include #include #include diff --git a/bitcoin/libbase58 b/bitcoin/libbase58 new file mode 160000 index 000000000..16c252760 --- /dev/null +++ b/bitcoin/libbase58 @@ -0,0 +1 @@ +Subproject commit 16c2527608053d2cc2fa05b2e3b5ae96065d1410 diff --git a/daemon/Makefile b/daemon/Makefile index 3a8198133..b2cb7f7f2 100644 --- a/daemon/Makefile +++ b/daemon/Makefile @@ -138,9 +138,9 @@ daemon/jsmn/jsmn.c: daemon/jsmn/jsmn.h daemon/jsmn.o: daemon/jsmn/jsmn.c $(COMPILE.c) -DJSMN_STRICT=1 $(OUTPUT_OPTION) $< -daemon/lightningd: $(DAEMON_OBJS) $(DAEMON_LIB_OBJS) $(DAEMON_JSMN_OBJS) $(CORE_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(CCAN_OBJS) libsecp256k1.a +daemon/lightningd: $(DAEMON_OBJS) $(DAEMON_LIB_OBJS) $(DAEMON_JSMN_OBJS) $(CORE_OBJS) $(BITCOIN_OBJS) $(LIBBASE58_OBJS) $(WIRE_OBJS) $(CCAN_OBJS) libsecp256k1.a -daemon/lightning-cli: $(DAEMON_CLI_OBJS) $(DAEMON_LIB_OBJS) $(DAEMON_JSMN_OBJS) $(CORE_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(CCAN_OBJS) libsecp256k1.a +daemon/lightning-cli: $(DAEMON_CLI_OBJS) $(DAEMON_LIB_OBJS) $(DAEMON_JSMN_OBJS) $(CORE_OBJS) $(BITCOIN_OBJS) $(LIBBASE58_OBJS) $(WIRE_OBJS) $(CCAN_OBJS) libsecp256k1.a daemon-clean: $(RM) $(DAEMON_OBJS) $(DAEMON_LIB_OBJS) $(DAEMON_CLI_OBJS) $(DAEMON_JSMN_OBJS) $(DAEMON_GEN_HEADERS)