Browse Source
Also, we split the more sophisticated json_add helpers to avoid pulling in everything into lightning-cli, and unify the routines to print struct short_channel_id (it's ':', not '/' too). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>ppa-0.6.1
Rusty Russell
7 years ago
committed by
Christian Decker
86 changed files with 387 additions and 394 deletions
@ -0,0 +1,37 @@ |
|||
LIGHTNING_CLI_SRC := cli/lightning-cli.c |
|||
LIGHTNING_CLI_OBJS := $(LIGHTNING_CLI_SRC:.c=.o) |
|||
|
|||
JSMN_OBJS := daemon/jsmn.o |
|||
JSMN_HEADERS := daemon/jsmn/jsmn.h |
|||
|
|||
LIGHTNING_CLI_COMMON_OBJS := \
|
|||
common/configdir.o \
|
|||
common/json.o \
|
|||
common/version.o |
|||
|
|||
lightning-cli-all: cli/lightning-cli |
|||
|
|||
$(LIGHTNINGD_OPENING_OBJS): $(LIGHTNINGD_HEADERS) |
|||
|
|||
# Git submodules are seriously broken.
|
|||
daemon/jsmn/jsmn.h: |
|||
git submodule update daemon/jsmn/ |
|||
[ -f $@ ] || git submodule update --init daemon/jsmn/ |
|||
|
|||
# If we tell Make that the above builds both, it runs it twice in
|
|||
# parallel. So we lie :(
|
|||
daemon/jsmn/jsmn.c: daemon/jsmn/jsmn.h |
|||
[ -f $@ ] |
|||
|
|||
daemon/jsmn.o: daemon/jsmn/jsmn.c |
|||
$(COMPILE.c) -DJSMN_STRICT=1 $(OUTPUT_OPTION) $< |
|||
|
|||
$(LIGHTNING_CLI_OBJS) $(JSMN_OBJS): $(JSMN_HEADERS) $(COMMON_HEADERS) $(CCAN_HEADERS) |
|||
|
|||
cli/lightning-cli: $(LIGHTNING_CLI_OBJS) $(LIGHTNING_CLI_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) |
|||
|
|||
clean: lightning-cli-clean |
|||
|
|||
lightning-cli-clean: |
|||
$(RM) $(LIGHTNING-CLI_LIB_OBJS) $(DAEMON_JSMN_OBJS) |
|||
|
@ -1,14 +1,14 @@ |
|||
/*
|
|||
* Helper to submit via JSON-RPC and get back response. |
|||
*/ |
|||
#include "configdir.h" |
|||
#include "json.h" |
|||
#include "version.h" |
|||
#include <ccan/err/err.h> |
|||
#include <ccan/opt/opt.h> |
|||
#include <ccan/read_write_all/read_write_all.h> |
|||
#include <ccan/str/str.h> |
|||
#include <ccan/tal/str/str.h> |
|||
#include <common/configdir.h> |
|||
#include <common/json.h> |
|||
#include <common/version.h> |
|||
#include <stdio.h> |
|||
#include <sys/socket.h> |
|||
#include <sys/types.h> |
@ -1,26 +1,37 @@ |
|||
COMMON_SRC := \
|
|||
common/close_tx.c \
|
|||
common/configdir.c \
|
|||
common/derive_basepoints.c \
|
|||
common/funding_tx.c \
|
|||
common/htlc_tx.c \
|
|||
common/htlc_state.c \
|
|||
common/initial_channel.c \
|
|||
common/initial_commit_tx.c \
|
|||
common/json.c \
|
|||
common/permute_tx.c \
|
|||
common/pseudorand.c \
|
|||
common/timeout.c \
|
|||
common/type_to_string.c \
|
|||
common/utils.c \
|
|||
common/version.c \
|
|||
common/withdraw_tx.c |
|||
|
|||
COMMON_HEADERS := $(COMMON_SRC:.c=.h) common/overflows.h |
|||
COMMON_HEADERS_NOGEN := $(COMMON_SRC:.c=.h) common/overflows.h common/htlc.h |
|||
COMMON_HEADERS_GEN := common/gen_htlc_state_names.h |
|||
|
|||
COMMON_HEADERS := $(COMMON_HEADERS_GEN) $(COMMON_HEADERS_NOGEN) |
|||
COMMON_OBJS := $(COMMON_SRC:.c=.o) |
|||
|
|||
common/gen_htlc_state_names.h: common/htlc_state.h ccan/ccan/cdump/tools/cdump-enumstr |
|||
ccan/ccan/cdump/tools/cdump-enumstr common/htlc_state.h > $@ |
|||
|
|||
check-makefile: check-common-makefile |
|||
|
|||
check-common-makefile: |
|||
@if [ x"`LC_ALL=C ls common/*.h | grep -v ^gen_`" != x"`echo $(COMMON_HEADERS) | tr ' ' '\n' | LC_ALL=C sort`" ]; then echo COMMON_HEADERS incorrect; exit 1; fi |
|||
@if [ x"`LC_ALL=C ls common/*.h | grep -v ^common/gen_`" != x"`echo $(COMMON_HEADERS_NOGEN) | tr ' ' '\n' | LC_ALL=C sort`" ]; then echo COMMON_HEADERS_NOGEN incorrect; exit 1; fi |
|||
|
|||
check-source-bolt: $(COMMON_SRC:%=bolt-check/%) $(COMMON_HEADERS:%=bolt-check/%) |
|||
check-whitespace: $(COMMON_SRC:%=check-whitespace/%) $(COMMON_HEADERS:%=check-whitespace/%) |
|||
|
|||
check-source: $(COMMON_SRC:%=check-src-include-order/%) \ |
|||
$(COMMON_HEADERS:%=check-hdr-include-order/%) |
|||
$(COMMON_HEADERS_NOGEN:%=check-hdr-include-order/%) |
|||
|
@ -1,5 +1,4 @@ |
|||
#include "configdir.h" |
|||
#include "log.h" |
|||
#include <ccan/opt/opt.h> |
|||
#include <ccan/tal/path/path.h> |
|||
#include <ccan/tal/str/str.h> |
@ -1,6 +1,6 @@ |
|||
#include "htlc.h" |
|||
#include "gen_htlc_state_names.h" |
|||
#include <ccan/array_size/array_size.h> |
|||
#include <common/htlc.h> |
|||
#include "gen_htlc_state_names.h" |
|||
|
|||
const char *htlc_state_name(enum htlc_state s) |
|||
{ |
@ -1,4 +1,3 @@ |
|||
#include "lightningd.h" |
|||
#include "timeout.h" |
|||
#include <common/utils.h> |
|||
|
@ -1,135 +0,0 @@ |
|||
#ifndef LIGHTNING_DAEMON_LIGHTNING_H |
|||
#define LIGHTNING_DAEMON_LIGHTNING_H |
|||
#include "config.h" |
|||
#include "bitcoin/pubkey.h" |
|||
#include "watch.h" |
|||
#include <ccan/list/list.h> |
|||
#include <ccan/short_types/short_types.h> |
|||
#include <ccan/timer/timer.h> |
|||
#include <stdio.h> |
|||
#include <wire/wire.h> |
|||
|
|||
/* Various adjustable things. */ |
|||
struct config { |
|||
/* How long do we want them to lock up their funds? (blocks) */ |
|||
u32 locktime_blocks; |
|||
|
|||
/* How long do we let them lock up our funds? (blocks) */ |
|||
u32 locktime_max; |
|||
|
|||
/* How many blocks before we expect to see anchor?. */ |
|||
u32 anchor_onchain_wait; |
|||
|
|||
/* How many confirms until we consider an anchor "settled". */ |
|||
u32 anchor_confirms; |
|||
|
|||
/* How long will we accept them waiting? */ |
|||
u32 anchor_confirms_max; |
|||
|
|||
/* How many blocks until we stop watching a close commit? */ |
|||
u32 forever_confirms; |
|||
|
|||
/* Maximum percent of fee rate we'll accept. */ |
|||
u32 commitment_fee_max_percent; |
|||
|
|||
/* Minimum percent of fee rate we'll accept. */ |
|||
u32 commitment_fee_min_percent; |
|||
|
|||
/* Percent of fee rate we'll use. */ |
|||
u32 commitment_fee_percent; |
|||
|
|||
/* Minimum/maximum time for an expiring HTLC (blocks). */ |
|||
u32 min_htlc_expiry, max_htlc_expiry; |
|||
|
|||
/* How many blocks before upstream HTLC expiry do we panic and dump? */ |
|||
u32 deadline_blocks; |
|||
|
|||
/* Fee rates. */ |
|||
u32 fee_base; |
|||
s32 fee_per_satoshi; |
|||
|
|||
/* How long between polling bitcoind. */ |
|||
struct timerel poll_time; |
|||
|
|||
/* How long between changing commit and sending COMMIT message. */ |
|||
struct timerel commit_time; |
|||
|
|||
/* Whether to enable IRC peer discovery. */ |
|||
bool use_irc; |
|||
|
|||
/* Whether to ignore database version. */ |
|||
bool db_version_ignore; |
|||
|
|||
/* IPv4 or IPv6 address to announce to the network */ |
|||
struct ipaddr ipaddr; |
|||
}; |
|||
|
|||
/* Here's where the global variables hide! */ |
|||
struct lightningd_state { |
|||
/* Where all our logging goes. */ |
|||
struct log_book *log_book; |
|||
struct log *base_log; |
|||
FILE *logf; |
|||
|
|||
/* Our config dir, and rpc file */ |
|||
char *config_dir; |
|||
char *rpc_filename; |
|||
|
|||
/* Port we're listening on */ |
|||
u16 portnum; |
|||
|
|||
/* We're on testnet. */ |
|||
bool testnet; |
|||
|
|||
/* Configuration settings. */ |
|||
struct config config; |
|||
|
|||
/* The database where we keep our stuff. */ |
|||
struct db *db; |
|||
|
|||
/* Any pending timers. */ |
|||
struct timers timers; |
|||
|
|||
/* Cached block topology. */ |
|||
struct chain_topology *topology; |
|||
|
|||
/* Our peers. */ |
|||
struct list_head peers; |
|||
|
|||
/* Addresses to contact peers. */ |
|||
struct list_head addresses; |
|||
|
|||
/* Any outstanding "pay" commands. */ |
|||
struct list_head pay_commands; |
|||
|
|||
/* Our private key */ |
|||
struct privkey *privkey; |
|||
|
|||
/* This is us. */ |
|||
struct pubkey id; |
|||
|
|||
/* Our tame bitcoind. */ |
|||
struct bitcoind *bitcoind; |
|||
|
|||
/* Wallet addresses we maintain. */ |
|||
struct list_head wallet; |
|||
|
|||
/* Maintained by invoices.c */ |
|||
struct invoices *invoices; |
|||
|
|||
/* Routing information */ |
|||
struct routing_state *rstate; |
|||
|
|||
/* For testing: don't fail if we can't route. */ |
|||
bool dev_never_routefail; |
|||
|
|||
/* Re-exec hack for testing. */ |
|||
char **reexec; |
|||
|
|||
/* IP/hostname to be announced for incoming connections */ |
|||
char *external_ip; |
|||
|
|||
/* Announce timer. */ |
|||
struct oneshot *announce; |
|||
}; |
|||
#endif /* LIGHTNING_DAEMON_LIGHTNING_H */ |
@ -1,4 +1,4 @@ |
|||
#include "daemon/broadcast.h" |
|||
#include <lightningd/gossip/broadcast.h> |
|||
|
|||
struct broadcast_state *new_broadcast_state(tal_t *ctx) |
|||
{ |
@ -1,10 +1,10 @@ |
|||
#ifndef LIGHTNING_DAEMON_ROUTING_H |
|||
#define LIGHTNING_DAEMON_ROUTING_H |
|||
#include "config.h" |
|||
#include "bitcoin/pubkey.h" |
|||
#include "daemon/broadcast.h" |
|||
#include "wire/wire.h" |
|||
#include <bitcoin/pubkey.h> |
|||
#include <ccan/htable/htable_type.h> |
|||
#include <lightningd/gossip/broadcast.h> |
|||
#include <wire/wire.h> |
|||
|
|||
#define ROUTING_MAX_HOPS 20 |
|||
#define ROUTING_FLAGS_DISABLED 2 |
@ -1,4 +1,3 @@ |
|||
#include "db.h" |
|||
#include "invoice.h" |
|||
#include "jsonrpc.h" |
|||
#include "lightningd.h" |
Loading…
Reference in new issue