Skip to content

Commit

Permalink
routing: Wiring in the IRC peer discovery
Browse files Browse the repository at this point in the history
Added a flag to disable the IRC discovery and calling the entrypoint to
start the IRC client loop.
  • Loading branch information
cdecker committed Sep 7, 2016
1 parent f4568e5 commit 2f6eefc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions daemon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ DAEMON_SRC := \
daemon/feechange.c \
daemon/htlc.c \
daemon/invoice.c \
daemon/irc_announce.c \
daemon/jsonrpc.c \
daemon/lightningd.c \
daemon/netaddr.c \
Expand All @@ -41,6 +42,7 @@ DAEMON_SRC := \
daemon/wallet.c \
daemon/watch.c \
names.c \
irc.c \
state.c

DAEMON_OBJS := $(DAEMON_SRC:.c=.o)
Expand Down
11 changes: 11 additions & 0 deletions daemon/lightningd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "configdir.h"
#include "controlled_time.h"
#include "db.h"
#include "irc_announce.h"
#include "jsonrpc.h"
#include "lightningd.h"
#include "log.h"
Expand Down Expand Up @@ -145,6 +146,9 @@ static void config_register_opts(struct lightningd_state *dstate)
dstate,
"Add route of form srcid/dstid/base/var/delay/minblocks"
"(base in millisatoshi, var in millionths of satoshi per satoshi)");
opt_register_noarg("--disable-irc", opt_set_invbool,
&dstate->config.use_irc,
"Disable IRC peer discovery for routing");
}

static void dev_register_opts(struct lightningd_state *dstate)
Expand Down Expand Up @@ -210,6 +214,9 @@ static void default_config(struct config *config)
config->fee_base = 546000;
/* Take 0.001% */
config->fee_per_satoshi = 10;

/* Discover new peers using IRC */
config->use_irc = true;
}

static void check_config(struct lightningd_state *dstate)
Expand Down Expand Up @@ -360,6 +367,10 @@ int main(int argc, char *argv[])
/* Set up connections from peers. */
setup_listeners(dstate, portnum);

/* set up IRC peer discovery */
if (dstate->config.use_irc)
setup_irc_connection(dstate);

/* Make sure we use the artificially-controlled time for timers */
io_time_override(controlled_time);

Expand Down
3 changes: 3 additions & 0 deletions daemon/lightningd.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ struct config {

/* How long between changing commit and sending COMMIT message. */
struct timerel commit_time;

/* Whether to enable IRC peer discovery. */
bool use_irc;
};

/* Here's where the global variables hide! */
Expand Down

0 comments on commit 2f6eefc

Please sign in to comment.