From 1bfa02d877353ba41759d174cd5ff19cd4208600 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 20 Jun 2018 13:11:25 +0200 Subject: [PATCH] opts: Add option to disable DNS lookups Mainly used to disable `gossipd` reaching out to the DNS seeds during testing. Signed-off-by: Christian Decker --- doc/lightningd-config.5 | 17 ++++++++++++----- doc/lightningd-config.5.txt | 7 +++++-- lightningd/lightningd.h | 3 +++ lightningd/options.c | 7 +++++++ 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/doc/lightningd-config.5 b/doc/lightningd-config.5 index 26a63b934..af5fb86ac 100644 --- a/doc/lightningd-config.5 +++ b/doc/lightningd-config.5 @@ -2,12 +2,12 @@ .\" Title: lightningd-config .\" Author: [see the "AUTHOR" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 05/10/2018 +.\" Date: 06/20/2018 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "LIGHTNINGD\-CONFIG" "5" "05/10/2018" "\ \&" "\ \&" +.TH "LIGHTNINGD\-CONFIG" "5" "06/20/2018" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -203,14 +203,16 @@ How long to wait before sending commitment messages to the peer: in theory incre .sp Lightning channel and HTLC options: .PP -\fBlocktime\-blocks\fR=\fIBLOCKS\fR +\fBwatchtime\-blocks\fR=\fIBLOCKS\fR .RS 4 -How long we need to spot an outdated close attempt, which is also how long the peer would need to wait if they perform a unilateral close\&. +How long we need to spot an outdated close attempt: on opening a channel we tell our peer that this is how long they\(cqll have to wait if they perform a unilateral close\&. .RE .PP \fBmax\-locktime\-blocks\fR=\fIBLOCKS\fR .RS 4 -The longest we\(cqll ever allow a peer to hold up payments, in the worst case\&. If they ask for longer, we\(cqll refuse to create a channel, and if an HTLC asks for longer, we\(cqll refuse it\&. +The longest our funds can be delayed (ie\&. the longest +\fBwatchtime\-blocks\fR +our peer can ask for, and also the longest HTLC timeout we will accept)\&. If our peer asks for longer, we\(cqll refuse to create a channel, and if an HTLC asks for longer, we\(cqll refuse it\&. .RE .PP \fBfunding\-confirms\fR=\fIBLOCKS\fR @@ -408,6 +410,11 @@ Always use the \fBproxy\fR, even to connect to normal IP addresses (you can still connect to Unix domain sockets manually)\&. This also disables all DNS lookups, to avoid leaking information\&. .RE .PP +\fBdisable\-dns\fR +.RS 4 +Disable the DNS bootstrapping mechanism to find a node by its node ID\&. +.RE +.PP \fBtor\-service\-password\fR=\fIPASSWORD\fR .RS 4 Set a Tor control password, which may be needed for diff --git a/doc/lightningd-config.5.txt b/doc/lightningd-config.5.txt index c4673bece..e860b964e 100644 --- a/doc/lightningd-config.5.txt +++ b/doc/lightningd-config.5.txt @@ -100,7 +100,7 @@ Lightning daemon options: *pid-file*='PATH':: Specify pid file to write to. - + *log-level*='LEVEL':: What log level to print out: options are io, debug, info, unusual, broken. @@ -278,10 +278,13 @@ or precisely control where to bind and what to announce with the can still connect to Unix domain sockets manually). This also disables all DNS lookups, to avoid leaking information. +*disable-dns*:: + Disable the DNS bootstrapping mechanism to find a node by its node ID. + *tor-service-password*='PASSWORD':: Set a Tor control password, which may be needed for 'autotor:' to authenticate to the Tor control port. - + BUGS ---- You should report bugs on our github issues page, and maybe submit a diff --git a/lightningd/lightningd.h b/lightningd/lightningd.h index b57d097a3..3a979507c 100644 --- a/lightningd/lightningd.h +++ b/lightningd/lightningd.h @@ -64,6 +64,9 @@ struct config { /* Accept fee changes only if they are in the range our_fee - * our_fee*multiplier */ u32 max_fee_multiplier; + + /* Are we allowed to use DNS lookup for peers. */ + bool use_dns; }; struct lightningd { diff --git a/lightningd/options.c b/lightningd/options.c index 6acc05768..6f6ac4372 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -409,6 +409,9 @@ static void config_register_opts(struct lightningd *ld) opt_set_bool_arg, opt_show_bool, &ld->use_proxy_always, "Use the proxy always"); + opt_register_noarg("--disable-dns", opt_set_invbool, &ld->config.use_dns, + "Disable DNS lookups of peers"); + #if DEVELOPER opt_register_arg("--dev-max-funding-unconfirmed-blocks", opt_set_u32, opt_show_u32, @@ -529,6 +532,8 @@ static const struct config testnet_config = { /* Fees may be in the range our_fee - 10*our_fee */ .max_fee_multiplier = 10, + + .use_dns = true, }; /* aka. "Dude, where's my coins?" */ @@ -590,6 +595,8 @@ static const struct config mainnet_config = { /* Fees may be in the range our_fee - 10*our_fee */ .max_fee_multiplier = 10, + + .use_dns = true, }; static void check_config(struct lightningd *ld)