Browse Source

routing: Wiring in the IRC peer discovery

Added a flag to disable the IRC discovery and calling the entrypoint to
start the IRC client loop.
ppa-0.6.1
Christian Decker 8 years ago
parent
commit
2f6eefc49b
  1. 2
      daemon/Makefile
  2. 11
      daemon/lightningd.c
  3. 3
      daemon/lightningd.h

2
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)

11
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);

3
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! */

Loading…
Cancel
Save