From 85eff42d9a4b991791fe644a3457443c1de6e175 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 10 May 2018 08:48:23 +0930 Subject: [PATCH] common/tor: move into lightningd. This is simply the code to set up the automatic hidden service, so move it into lightningd. I removed the undefined parse_tor_wireaddr, and added a parameter name to the create_tor_hidden_service_conn() declaration for update-mocks. Signed-off-by: Rusty Russell --- common/Makefile | 1 - common/tor.h | 13 ------------- lightningd/Makefile | 2 +- lightningd/lightningd.c | 2 +- lightningd/options.c | 1 - lightningd/test/run-find_my_path.c | 7 ++++++- {common => lightningd}/tor.c | 2 +- lightningd/tor.h | 12 ++++++++++++ 8 files changed, 21 insertions(+), 19 deletions(-) delete mode 100644 common/tor.h rename {common => lightningd}/tor.c (99%) create mode 100644 lightningd/tor.h diff --git a/common/Makefile b/common/Makefile index 7f996c2d1..7ed75f638 100644 --- a/common/Makefile +++ b/common/Makefile @@ -42,7 +42,6 @@ COMMON_SRC_NOGEN := \ common/timeout.c \ common/type_to_string.c \ common/utils.c \ - common/tor.c \ common/utxo.c \ common/version.c \ common/wallet_tx.c \ diff --git a/common/tor.h b/common/tor.h deleted file mode 100644 index 54d4dccc5..000000000 --- a/common/tor.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef LIGHTNING_COMMON_TOR_H -#define LIGHTNING_COMMON_TOR_H -#include "config.h" -#include -#include -#include -#include -#include - -bool check_return_from_service_call(void); -bool parse_tor_wireaddr(const char *arg,u8 *ip_ld,u16 *port_ld); -bool create_tor_hidden_service_conn(struct lightningd *); -#endif /* LIGHTNING_COMMON_TOR_H */ diff --git a/lightningd/Makefile b/lightningd/Makefile index 44691a011..6ecd5bebc 100644 --- a/lightningd/Makefile +++ b/lightningd/Makefile @@ -44,7 +44,6 @@ LIGHTNINGD_COMMON_OBJS := \ common/type_to_string.o \ common/utils.o \ common/utxo.o \ - common/tor.o \ common/version.o \ common/wallet_tx.o \ common/wire_error.o \ @@ -77,6 +76,7 @@ LIGHTNINGD_SRC := \ lightningd/peer_control.c \ lightningd/peer_htlcs.c \ lightningd/subd.c \ + lightningd/tor.c \ lightningd/watch.c # Source files without corresponding headers diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index ddbbc3662..9a42acc6b 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -33,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/lightningd/options.c b/lightningd/options.c index f877775af..16458fc85 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include diff --git a/lightningd/test/run-find_my_path.c b/lightningd/test/run-find_my_path.c index a1956bd3f..42c51442d 100644 --- a/lightningd/test/run-find_my_path.c +++ b/lightningd/test/run-find_my_path.c @@ -2,7 +2,6 @@ int unused_main(int argc, char *argv[]); #include "../../common/base32.c" #include "../../common/wireaddr.c" -#include "../../common/tor.c" #include "../lightningd.c" /* AUTOGENERATED MOCKS START */ @@ -12,6 +11,12 @@ void activate_peers(struct lightningd *ld UNNEEDED) /* Generated stub for begin_topology */ void begin_topology(struct chain_topology *topo UNNEEDED) { fprintf(stderr, "begin_topology called!\n"); abort(); } +/* Generated stub for check_return_from_service_call */ +bool check_return_from_service_call(void) +{ fprintf(stderr, "check_return_from_service_call called!\n"); abort(); } +/* Generated stub for create_tor_hidden_service_conn */ +bool create_tor_hidden_service_conn(struct lightningd *ld UNNEEDED) +{ fprintf(stderr, "create_tor_hidden_service_conn called!\n"); abort(); } /* Generated stub for daemon_setup */ void daemon_setup(const char *argv0 UNNEEDED, void (*backtrace_print)(const char *fmt UNNEEDED, ...) UNNEEDED, diff --git a/common/tor.c b/lightningd/tor.c similarity index 99% rename from common/tor.c rename to lightningd/tor.c index 3252afa6a..286671f29 100644 --- a/common/tor.c +++ b/lightningd/tor.c @@ -4,12 +4,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/lightningd/tor.h b/lightningd/tor.h new file mode 100644 index 000000000..d90fe0a9b --- /dev/null +++ b/lightningd/tor.h @@ -0,0 +1,12 @@ +#ifndef LIGHTNING_LIGHTNINGD_TOR_H +#define LIGHTNING_LIGHTNINGD_TOR_H +#include "config.h" +#include +#include +#include +#include +#include + +bool check_return_from_service_call(void); +bool create_tor_hidden_service_conn(struct lightningd *ld); +#endif /* LIGHTNING_LIGHTNINGD_TOR_H */