2017-01-10 06:07:51 +01:00
#! /usr/bin/make
# Designed to be run one level up
lightningd-wrongdir :
$( MAKE) -C .. lightningd-all
2017-08-29 06:12:04 +02:00
LIGHTNINGD_PROGRAM := lightningd/lightningd
2017-07-05 07:33:40 +02:00
2017-08-29 06:12:04 +02:00
ALL_PROGRAMS += $( LIGHTNINGD_PROGRAM)
2017-08-28 18:11:01 +02:00
2017-08-29 06:12:04 +02:00
lightningd-all : $( LIGHTNINGD_PROGRAM )
2017-01-10 06:07:51 +01:00
default : lightningd -all
2017-08-28 18:02:01 +02:00
# Common source we use.
LIGHTNINGD_COMMON_OBJS := \
2019-02-21 01:45:57 +01:00
common/amount.o \
2018-05-10 01:18:19 +02:00
common/base32.o \
2017-11-22 01:25:01 +01:00
common/bech32.o \
2018-04-23 16:20:55 +02:00
common/bech32_util.o \
2017-08-28 18:05:01 +02:00
common/bip32.o \
2017-11-22 01:25:39 +01:00
common/bolt11.o \
2017-08-28 18:05:01 +02:00
common/channel_config.o \
2017-08-28 18:04:01 +02:00
common/configdir.o \
2017-10-11 11:56:50 +02:00
common/crypto_state.o \
2018-03-29 04:06:45 +02:00
common/daemon.o \
2017-08-28 18:02:01 +02:00
common/derive_basepoints.o \
2018-01-12 14:35:52 +01:00
common/features.o \
2017-08-28 18:02:01 +02:00
common/funding_tx.o \
2018-02-19 02:06:15 +01:00
common/gen_peer_status_wire.o \
2018-02-08 02:25:12 +01:00
common/gen_status_wire.o \
2017-10-26 05:04:19 +02:00
common/hash_u5.o \
2017-08-28 18:04:01 +02:00
common/htlc_state.o \
2017-08-28 18:05:01 +02:00
common/htlc_wire.o \
common/key_derive.o \
2018-09-26 20:57:43 +02:00
common/io_lock.o \
2017-08-28 18:04:01 +02:00
common/json.o \
2018-12-08 01:39:28 +01:00
common/json_escaped.o \
2019-01-15 04:54:27 +01:00
common/json_helpers.o \
2018-12-08 01:39:28 +01:00
common/json_tok.o \
2017-12-15 11:17:54 +01:00
common/memleak.o \
2017-08-28 18:05:01 +02:00
common/msg_queue.o \
common/node_id: new type.
Node ids are pubkeys, but we only use them as pubkeys for routing and checking
gossip messages. So we're packing and unpacking them constantly, and wasting
some space and time.
This introduces a new type, explicitly the SEC1 compressed encoding
(33 bytes). We ensure its validity when we load from the db, or get it
from JSON. We still use 'struct pubkey' for peer messages, which checks
validity.
Results from 5 runs, min-max(mean +/- stddev):
store_load_msec,vsz_kb,store_rewrite_sec,listnodes_sec,listchannels_sec,routing_sec,peer_write_all_sec
39475-39572(39518+/-36),2880732,41.150000-41.390000(41.298+/-0.085),2.260000-2.550000(2.336+/-0.11),44.390000-65.150000(58.648+/-7.5),32.740000-33.020000(32.89+/-0.093),44.130000-45.090000(44.566+/-0.32)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-04-08 08:34:06 +02:00
common/node_id.o \
2018-12-08 01:39:28 +01:00
common/param.o \
2017-08-28 18:02:01 +02:00
common/permute_tx.o \
2017-08-28 18:04:01 +02:00
common/pseudorand.o \
2017-08-28 18:05:01 +02:00
common/sphinx.o \
2018-02-08 02:25:12 +01:00
common/status_wire.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-08-28 18:05:01 +02:00
common/utxo.o \
2017-08-28 18:02:01 +02:00
common/version.o \
2018-04-05 21:19:47 +02:00
common/wallet_tx.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 \
2017-10-23 06:17:38 +02:00
common/wireaddr.o \
2018-09-20 05:06:42 +02:00
common/withdraw_tx.o \
2018-09-20 05:06:42 +02:00
hsmd/gen_hsm_wire.o
2017-08-28 18:02:01 +02:00
2017-01-10 06:07:51 +01:00
LIGHTNINGD_SRC := \
2017-08-28 18:04:01 +02:00
lightningd/bitcoind.c \
lightningd/chaintopology.c \
2018-02-12 11:12:55 +01:00
lightningd/channel.c \
2018-02-20 21:59:09 +01:00
lightningd/channel_control.c \
2018-02-20 21:59:09 +01:00
lightningd/closing_control.c \
2018-02-20 21:59:09 +01:00
lightningd/connect_control.c \
2017-01-10 06:08:33 +01:00
lightningd/gossip_control.c \
2017-08-28 18:05:01 +02:00
lightningd/gossip_msg.c \
2017-01-10 06:08:33 +01:00
lightningd/hsm_control.c \
2017-08-28 18:04:01 +02:00
lightningd/htlc_end.c \
lightningd/invoice.c \
2018-03-16 04:45:08 +01:00
lightningd/json.c \
2018-11-20 02:46:32 +01:00
lightningd/json_stream.c \
2017-08-28 18:04:01 +02:00
lightningd/jsonrpc.c \
2017-01-10 06:08:33 +01:00
lightningd/lightningd.c \
2017-08-28 18:04:01 +02:00
lightningd/log.c \
2018-02-05 05:09:27 +01:00
lightningd/log_status.c \
2018-11-22 03:17:29 +01:00
lightningd/memdump.c \
2018-12-12 14:36:11 +01:00
lightningd/notification.c \
2018-02-20 21:59:09 +01:00
lightningd/onchain_control.c \
2018-02-20 21:59:04 +01:00
lightningd/opening_control.c \
2017-08-28 18:04:01 +02:00
lightningd/options.c \
2017-04-01 15:05:29 +02:00
lightningd/pay.c \
2017-01-10 06:08:33 +01:00
lightningd/peer_control.c \
2017-06-20 07:45:03 +02:00
lightningd/peer_htlcs.c \
2018-09-11 21:57:11 +02:00
lightningd/ping.c \
2018-09-19 22:19:51 +02:00
lightningd/plugin.c \
2018-12-20 12:00:35 +01:00
lightningd/plugin_hook.c \
2017-08-28 18:04:01 +02:00
lightningd/subd.c \
lightningd/watch.c
2017-01-10 06:07:51 +01:00
2018-11-22 03:17:29 +01:00
LIGHTNINGD_OBJS := $( LIGHTNINGD_SRC:.c= .o)
2017-01-10 06:07:51 +01:00
2017-08-28 18:13:01 +02:00
# Make sure these depend on everything.
ALL_OBJS += $( LIGHTNINGD_OBJS)
2017-01-13 01:18:11 +01:00
# We accumulate all lightningd/ headers in these three:
LIGHTNINGD_HEADERS_NOGEN = \
2017-08-28 18:04:01 +02:00
$( LIGHTNINGD_SRC:.c= .h) \
2018-12-08 01:39:28 +01:00
lightningd/channel_state.h
2017-01-13 01:18:11 +01:00
# Generated headers
LIGHTNINGD_HEADERS_GEN = \
2018-02-19 02:06:14 +01:00
lightningd/gen_channel_state_names.h
2017-01-13 01:18:11 +01:00
2017-08-29 06:12:04 +02:00
ALL_GEN_HEADERS += $( LIGHTNINGD_HEADERS_GEN)
2018-09-11 22:22:49 +02:00
i n c l u d e w a l l e t / M a k e f i l e
2017-01-13 01:18:11 +01:00
# All together in one convenient var
2018-09-11 22:23:31 +02:00
LIGHTNINGD_HEADERS = $( LIGHTNINGD_HEADERS_NOGEN) $( LIGHTNINGD_HEADERS_GEN) $( WALLET_LIB_HEADERS)
2017-01-13 01:18:11 +01:00
2017-11-27 16:17:43 +01:00
$(LIGHTNINGD_OBJS) : $( LIGHTNINGD_HEADERS )
2017-01-12 14:15:30 +01:00
2018-02-19 02:06:14 +01:00
lightningd/gen_channel_state_names.h : lightningd /channel_state .h ccan /ccan /cdump /tools /cdump -enumstr
ccan/ccan/cdump/tools/cdump-enumstr lightningd/channel_state.h > $@
2017-05-22 13:24:59 +02:00
2017-08-28 18:04:01 +02:00
check-source : $( LIGHTNINGD_SRC :%=check -src -include -order /%) $( LIGHTNINGD_SRC_NOHDR :%=check -src -include -order /%)
2017-01-13 01:18:11 +01:00
check-source : $( LIGHTNINGD_HEADERS_NOGEN :%=check -hdr -include -order /%)
2017-08-28 18:05:01 +02:00
check-source-bolt : $( LIGHTNINGD_SRC :%=bolt -check /%) $( LIGHTNINGD_HEADERS_NOGEN :%=bolt -check /%)
2017-01-10 06:07:51 +01:00
2017-08-28 18:05:01 +02:00
check-whitespace : $( LIGHTNINGD_SRC :%=check -whitespace /%) $( LIGHTNINGD_HEADERS_NOGEN :%=check -whitespace /%)
2017-01-10 06:07:51 +01:00
2017-01-13 01:18:11 +01:00
check-makefile : check -lightningd -makefile
2017-01-10 06:07:51 +01:00
check-lightningd-makefile :
2017-01-13 01:18:11 +01:00
@for f in lightningd/*.h lightningd/*/*.h; do if ! echo $( LIGHTNINGD_HEADERS_NOGEN) $( LIGHTNINGD_HEADERS_GEN) "" | grep -q " $$ f " ; then echo $$ f not mentioned in LIGHTNINGD_HEADERS_NOGEN or LIGHTNINGD_HEADERS_GEN >& 2; exit 1; fi ; done
2017-01-10 06:07:51 +01:00
2018-09-26 20:57:43 +02:00
lightningd/lightningd : $( LIGHTNINGD_OBJS ) $( LIGHTNINGD_COMMON_OBJS ) $( BITCOIN_OBJS ) $( WIRE_OBJS ) $( WIRE_ONION_OBJS ) $( LIGHTNINGD_HANDSHAKE_CONTROL_OBJS ) $( LIGHTNINGD_GOSSIP_CONTROL_OBJS ) $( LIGHTNINGD_OPENING_CONTROL_OBJS ) $( LIGHTNINGD_CHANNEL_CONTROL_OBJS ) $( LIGHTNINGD_CLOSING_CONTROL_OBJS ) $( LIGHTNINGD_ONCHAIN_CONTROL_OBJS ) $( WALLET_LIB_OBJS ) $( LIGHTNINGD_CONNECT_CONTROL_OBJS )
2017-01-10 06:07:51 +01:00
clean : lightningd -clean
lightningd-clean :
2017-11-23 04:03:07 +01:00
$( RM) $( LIGHTNINGD_OBJS) $( LIGHTNINGD_JSMN_OBJS) $( LIGHTNINGD_PROGRAM) lightningd/gen*
2017-01-10 06:07:51 +01:00
2017-01-10 06:08:33 +01:00
i n c l u d e l i g h t n i n g d / t e s t / M a k e f i l e