2017-01-10 06:08:33 +01:00
|
|
|
#! /usr/bin/make
|
|
|
|
|
|
|
|
# Designed to be run one level up
|
2017-08-29 06:12:04 +02:00
|
|
|
gossipd-wrongdir:
|
|
|
|
$(MAKE) -C .. gossipd-all
|
2017-01-10 06:08:33 +01:00
|
|
|
|
2017-08-29 06:12:04 +02:00
|
|
|
default: gossipd-all
|
2017-01-10 06:08:33 +01:00
|
|
|
|
|
|
|
# Control daemon uses this:
|
2018-05-17 07:08:11 +02:00
|
|
|
LIGHTNINGD_GOSSIP_CONTROL_HEADERS := gossipd/gen_gossip_wire.h gossipd/gossip_constants.h
|
2017-08-29 06:12:04 +02:00
|
|
|
LIGHTNINGD_GOSSIP_CONTROL_SRC := gossipd/gen_gossip_wire.c
|
2017-01-10 06:08:33 +01:00
|
|
|
LIGHTNINGD_GOSSIP_CONTROL_OBJS := $(LIGHTNINGD_GOSSIP_CONTROL_SRC:.c=.o)
|
|
|
|
|
2017-08-29 06:12:04 +02:00
|
|
|
# gossipd needs these:
|
|
|
|
LIGHTNINGD_GOSSIP_HEADERS := gossipd/gen_gossip_wire.h \
|
2018-05-10 01:18:23 +02:00
|
|
|
gossipd/gossip.h \
|
2018-04-11 01:03:36 +02:00
|
|
|
gossipd/gen_gossip_store.h \
|
2018-03-13 12:08:03 +01:00
|
|
|
gossipd/gossip_store.h \
|
gossipd: rewrite to do the handshake internally.
Now the flow is much simpler from a lightningd POV:
1. If we want to connect to a peer, just send gossipd `gossipctl_reach_peer`.
2. Every new peer, gossipd hands up to lightningd, with global/local features
and the peer fd and a gossip fd using `gossip_peer_connected`
3. If lightningd doesn't want it, it just hands the peerfd and global/local
features back to gossipd using `gossipctl_handle_peer`
4. If a peer sends a non-gossip msg (eg `open_channel`) the gossipd sends
it up using `gossip_peer_nongossip`.
5. If lightningd wants to fund a channel, it simply calls `release_channel`.
Notes:
* There's no more "unique_id": we use the peer id.
* For the moment, we don't ask gossipd when we're told to list peers, so
connected peers without a channel don't appear in the JSON getpeers API.
* We add a `gossipctl_peer_addrhint` for the moment, so you can connect to
a specific ip/port, but using other sources is a TODO.
* We now (correctly) only give up on reaching a peer after we exchange init
messages, which changes the test_disconnect case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-11 12:09:49 +02:00
|
|
|
gossipd/handshake.h \
|
2018-05-07 06:29:21 +02:00
|
|
|
gossipd/netaddress.h \
|
2017-08-29 06:12:04 +02:00
|
|
|
gossipd/routing.h \
|
2018-05-10 01:18:24 +02:00
|
|
|
gossipd/tor_autoservice.h \
|
2018-05-10 01:18:23 +02:00
|
|
|
gossipd/tor.h \
|
2017-08-29 06:12:04 +02:00
|
|
|
gossipd/broadcast.h
|
2018-05-10 01:18:23 +02:00
|
|
|
LIGHTNINGD_GOSSIP_SRC := $(LIGHTNINGD_GOSSIP_HEADERS:.h=.c)
|
2017-01-10 06:08:33 +01:00
|
|
|
LIGHTNINGD_GOSSIP_OBJS := $(LIGHTNINGD_GOSSIP_SRC:.c=.o)
|
|
|
|
|
2017-08-28 18:13:01 +02:00
|
|
|
# Make sure these depend on everything.
|
|
|
|
ALL_OBJS += $(LIGHTNINGD_GOSSIP_OBJS)
|
2017-08-29 06:12:04 +02:00
|
|
|
ALL_PROGRAMS += lightningd/lightning_gossipd
|
2018-05-17 07:08:11 +02:00
|
|
|
ALL_GEN_HEADERS += gossipd/gen_gossip_wire.h
|
2017-08-28 18:13:01 +02:00
|
|
|
|
2017-01-10 06:08:33 +01:00
|
|
|
# For checking
|
2017-08-29 06:12:04 +02:00
|
|
|
LIGHTNINGD_GOSSIP_ALLSRC_NOGEN := $(filter-out gossipd/gen_%, $(LIGHTNINGD_GOSSIP_CLIENT_SRC) $(LIGHTNINGD_GOSSIP_SRC))
|
|
|
|
LIGHTNINGD_GOSSIP_ALLHEADERS_NOGEN := $(filter-out gossipd/gen_%, $(LIGHTNINGD_GOSSIP_CLIENT_HEADERS) $(LIGHTNINGD_GOSSIP_HEADERS))
|
2017-01-10 06:08:33 +01:00
|
|
|
|
2017-01-10 23:46:29 +01:00
|
|
|
# Add to headers which any object might need.
|
2017-01-13 01:18:11 +01:00
|
|
|
LIGHTNINGD_HEADERS_GEN += $(LIGHTNINGD_GOSSIP_HEADERS)
|
2017-01-10 23:46:29 +01:00
|
|
|
|
2017-08-28 18:02:01 +02:00
|
|
|
# Common source we use.
|
|
|
|
GOSSIPD_COMMON_OBJS := \
|
2018-05-10 01:18:19 +02:00
|
|
|
common/base32.o \
|
2018-04-23 16:20:55 +02:00
|
|
|
common/bech32.o \
|
|
|
|
common/bech32_util.o \
|
2017-11-29 12:09:06 +01:00
|
|
|
common/bip32.o \
|
2017-10-11 11:56:50 +02:00
|
|
|
common/crypto_state.o \
|
2017-08-28 18:05:01 +02:00
|
|
|
common/crypto_sync.o \
|
|
|
|
common/cryptomsg.o \
|
2018-03-29 04:06:45 +02:00
|
|
|
common/daemon.o \
|
2017-08-28 18:05:01 +02:00
|
|
|
common/daemon_conn.o \
|
|
|
|
common/dev_disconnect.o \
|
2018-01-12 15:10:21 +01:00
|
|
|
common/features.o \
|
2018-02-08 02:25:12 +01:00
|
|
|
common/gen_status_wire.o \
|
2017-08-28 18:05:01 +02:00
|
|
|
common/msg_queue.o \
|
|
|
|
common/ping.o \
|
2017-08-28 18:04:01 +02:00
|
|
|
common/pseudorand.o \
|
2017-08-28 18:05:01 +02:00
|
|
|
common/status.o \
|
2018-02-08 02:25:12 +01:00
|
|
|
common/status_wire.o \
|
2018-01-08 11:01:09 +01:00
|
|
|
common/subdaemon.o \
|
2017-08-28 18:04:01 +02:00
|
|
|
common/timeout.o \
|
2017-08-28 18:02:01 +02:00
|
|
|
common/type_to_string.o \
|
|
|
|
common/utils.o \
|
2017-11-29 12:09:06 +01:00
|
|
|
common/utxo.o \
|
2017-08-28 18:05:01 +02:00
|
|
|
common/version.o \
|
2017-10-23 06:17:38 +02:00
|
|
|
common/wireaddr.o \
|
gossipd: rewrite to do the handshake internally.
Now the flow is much simpler from a lightningd POV:
1. If we want to connect to a peer, just send gossipd `gossipctl_reach_peer`.
2. Every new peer, gossipd hands up to lightningd, with global/local features
and the peer fd and a gossip fd using `gossip_peer_connected`
3. If lightningd doesn't want it, it just hands the peerfd and global/local
features back to gossipd using `gossipctl_handle_peer`
4. If a peer sends a non-gossip msg (eg `open_channel`) the gossipd sends
it up using `gossip_peer_nongossip`.
5. If lightningd wants to fund a channel, it simply calls `release_channel`.
Notes:
* There's no more "unique_id": we use the peer id.
* For the moment, we don't ask gossipd when we're told to list peers, so
connected peers without a channel don't appear in the JSON getpeers API.
* We add a `gossipctl_peer_addrhint` for the moment, so you can connect to
a specific ip/port, but using other sources is a TODO.
* We now (correctly) only give up on reaching a peer after we exchange init
messages, which changes the test_disconnect case.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-10-11 12:09:49 +02:00
|
|
|
common/wire_error.o \
|
|
|
|
hsmd/client.o \
|
|
|
|
hsmd/gen_hsm_client_wire.o \
|
2018-01-18 00:32:36 +01:00
|
|
|
lightningd/gossip_msg.o \
|
|
|
|
wire/gen_onion_wire.o
|
2017-08-28 18:02:01 +02:00
|
|
|
|
2017-12-11 03:52:57 +01:00
|
|
|
$(LIGHTNINGD_GOSSIP_OBJS) $(LIGHTNINGD_GOSSIP_CLIENT_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_GOSSIP_HEADERS)
|
2017-01-10 06:08:33 +01:00
|
|
|
|
2017-01-12 14:15:30 +01:00
|
|
|
$(LIGHTNINGD_GOSSIP_CONTROL_OBJS) : $(LIGHTNINGD_GOSSIP_CONTROL_HEADERS)
|
|
|
|
|
2017-08-29 06:12:04 +02:00
|
|
|
gossipd-all: lightningd/lightning_gossipd $(LIGHTNINGD_GOSSIP_CLIENT_OBJS)
|
2017-01-10 06:08:33 +01:00
|
|
|
|
2017-08-29 06:12:04 +02:00
|
|
|
lightningd/lightning_gossipd: $(LIGHTNINGD_GOSSIP_OBJS) $(GOSSIPD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS)
|
2017-01-10 06:08:33 +01:00
|
|
|
|
2017-08-29 06:12:04 +02:00
|
|
|
gossipd/gen_gossip_wire.h: $(WIRE_GEN) gossipd/gossip_wire.csv
|
|
|
|
$(WIRE_GEN) --header $@ gossip_wire_type < gossipd/gossip_wire.csv > $@
|
2017-01-10 06:08:33 +01:00
|
|
|
|
2017-08-29 06:12:04 +02:00
|
|
|
gossipd/gen_gossip_wire.c: $(WIRE_GEN) gossipd/gossip_wire.csv
|
|
|
|
$(WIRE_GEN) ${@:.c=.h} gossip_wire_type < gossipd/gossip_wire.csv > $@
|
2017-01-10 06:08:33 +01:00
|
|
|
|
2018-04-11 01:03:36 +02:00
|
|
|
gossipd/gen_gossip_store.h: $(WIRE_GEN) gossipd/gossip_store.csv
|
|
|
|
$(WIRE_GEN) --header $@ gossip_store_type < gossipd/gossip_store.csv > $@
|
|
|
|
|
|
|
|
gossipd/gen_gossip_store.c: $(WIRE_GEN) gossipd/gossip_store.csv
|
|
|
|
$(WIRE_GEN) ${@:.c=.h} gossip_store_type < gossipd/gossip_store.csv > $@
|
|
|
|
|
|
|
|
|
2017-01-10 06:08:33 +01:00
|
|
|
check-source: $(LIGHTNINGD_GOSSIP_ALLSRC_NOGEN:%=check-src-include-order/%) $(LIGHTNINGD_GOSSIP_ALLHEADERS_NOGEN:%=check-hdr-include-order/%)
|
|
|
|
check-source-bolt: $(LIGHTNINGD_GOSSIP_SRC:%=bolt-check/%) $(LIGHTNINGD_GOSSIP_HEADERS:%=bolt-check/%)
|
|
|
|
check-whitespace: $(LIGHTNINGD_GOSSIP_ALLSRC_NOGEN:%=check-whitespace/%) $(LIGHTNINGD_GOSSIP_ALLHEADERS_NOGEN:%=check-whitespace/%)
|
|
|
|
|
2017-08-29 06:12:04 +02:00
|
|
|
clean: gossipd-clean
|
2017-01-10 06:08:33 +01:00
|
|
|
|
2017-08-29 06:12:04 +02:00
|
|
|
gossipd-clean:
|
2017-11-23 04:03:07 +01:00
|
|
|
$(RM) $(LIGHTNINGD_GOSSIP_OBJS) gossipd/gen_*
|
2017-01-10 06:08:33 +01:00
|
|
|
|
2017-11-29 12:09:06 +01:00
|
|
|
-include gossipd/test/Makefile
|