Skip to content

Commit

Permalink
common/tor: move into lightningd.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rustyrussell committed May 10, 2018
1 parent d9f1323 commit 85eff42
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 19 deletions.
1 change: 0 additions & 1 deletion common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
13 changes: 0 additions & 13 deletions common/tor.h

This file was deleted.

2 changes: 1 addition & 1 deletion lightningd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lightningd/lightningd.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <common/daemon.h>
#include <common/memleak.h>
#include <common/timeout.h>
#include <common/tor.h>
#include <common/utils.h>
#include <common/version.h>
#include <errno.h>
Expand All @@ -33,6 +32,7 @@
#include <lightningd/log.h>
#include <lightningd/onchain_control.h>
#include <lightningd/options.h>
#include <lightningd/tor.h>
#include <onchaind/onchain_wire.h>
#include <signal.h>
#include <sys/types.h>
Expand Down
1 change: 0 additions & 1 deletion lightningd/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <common/configdir.h>
#include <common/json_escaped.h>
#include <common/memleak.h>
#include <common/tor.h>
#include <common/version.h>
#include <common/wireaddr.h>
#include <errno.h>
Expand Down
7 changes: 6 additions & 1 deletion lightningd/test/run-find_my_path.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion common/tor.c → lightningd/tor.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#include <ccan/io/io.h>
#include <ccan/str/hex/hex.h>
#include <ccan/tal/str/str.h>
#include <common/tor.h>
#include <common/type_to_string.h>
#include <common/utils.h>
#include <common/wireaddr.h>
#include <errno.h>
#include <fcntl.h>
#include <lightningd/tor.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
Expand Down
12 changes: 12 additions & 0 deletions lightningd/tor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef LIGHTNING_LIGHTNINGD_TOR_H
#define LIGHTNING_LIGHTNINGD_TOR_H
#include "config.h"
#include <ccan/short_types/short_types.h>
#include <ccan/tal/tal.h>
#include <lightningd/lightningd.h>
#include <stdbool.h>
#include <stdlib.h>

bool check_return_from_service_call(void);
bool create_tor_hidden_service_conn(struct lightningd *ld);
#endif /* LIGHTNING_LIGHTNINGD_TOR_H */

0 comments on commit 85eff42

Please sign in to comment.