diff --git a/daemon/Makefile b/daemon/Makefile index a9d13b5b8..60f5cca3f 100644 --- a/daemon/Makefile +++ b/daemon/Makefile @@ -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 \ @@ -41,6 +42,7 @@ DAEMON_SRC := \ daemon/wallet.c \ daemon/watch.c \ names.c \ + irc.c \ state.c DAEMON_OBJS := $(DAEMON_SRC:.c=.o) diff --git a/daemon/lightningd.c b/daemon/lightningd.c index 8df13b2dd..fef17f629 100644 --- a/daemon/lightningd.c +++ b/daemon/lightningd.c @@ -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" @@ -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) @@ -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) @@ -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); diff --git a/daemon/lightningd.h b/daemon/lightningd.h index 88ccd4536..dc8f8d162 100644 --- a/daemon/lightningd.h +++ b/daemon/lightningd.h @@ -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! */