From fe1ba963327fc5d6efec60a76343c7e95374b2eb Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 10 May 2016 06:29:12 +0930 Subject: [PATCH] daemon: time options use opt_time. Currently this mean --bitcoin-poll; we're going to change the other time options to block heights anyway. Signed-off-by: Rusty Russell --- daemon/chaintopology.c | 2 +- daemon/lightningd.c | 10 ++++++---- daemon/lightningd.h | 4 ++-- daemon/test/test.sh | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/daemon/chaintopology.c b/daemon/chaintopology.c index 62a8cf08b..a4596b820 100644 --- a/daemon/chaintopology.c +++ b/daemon/chaintopology.c @@ -67,7 +67,7 @@ static void start_poll_chaintips(struct lightningd_state *dstate); static void next_topology_timer(struct lightningd_state *dstate) { - new_reltimer(dstate, dstate, time_from_sec(dstate->config.poll_seconds), + new_reltimer(dstate, dstate, dstate->config.poll_time, start_poll_chaintips, dstate); } diff --git a/daemon/lightningd.c b/daemon/lightningd.c index 28afb8b33..63b9375ed 100644 --- a/daemon/lightningd.c +++ b/daemon/lightningd.c @@ -5,6 +5,7 @@ #include "jsonrpc.h" #include "lightningd.h" #include "log.h" +#include "opt_time.h" #include "peer.h" #include "secrets.h" #include "timeout.h" @@ -14,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -98,9 +100,9 @@ static void config_register_opts(struct lightningd_state *dstate) opt_register_arg("--max-expiry", opt_set_u32, opt_show_u32, &dstate->config.max_expiry, "Maximum number of seconds to accept an HTLC before expiry"); - opt_register_arg("--bitcoind-poll", opt_set_u32, opt_show_u32, - &dstate->config.poll_seconds, - "Seconds between polling for new transactions"); + opt_register_arg("--bitcoind-poll", opt_set_time, opt_show_time, + &dstate->config.poll_time, + "Time between polling for new transactions"); } #define MINUTES 60 @@ -151,7 +153,7 @@ static void default_config(struct config *config) /* Don't lock up channel for more than 5 days. */ config->max_expiry = 5 * DAYS; - config->poll_seconds = 30; + config->poll_time = time_from_sec(30); } static void check_config(struct lightningd_state *dstate) diff --git a/daemon/lightningd.h b/daemon/lightningd.h index c3bc201bf..2799407c6 100644 --- a/daemon/lightningd.h +++ b/daemon/lightningd.h @@ -41,8 +41,8 @@ struct config { /* Minimum/maximum time for an expiring HTLC (seconds). */ u32 min_expiry, max_expiry; - /* How long (seconds) between polling bitcoind. */ - u32 poll_seconds; + /* How long between polling bitcoind. */ + struct timerel poll_time; }; /* Here's where the global variables hide! */ diff --git a/daemon/test/test.sh b/daemon/test/test.sh index a7b49773d..69bbb2652 100755 --- a/daemon/test/test.sh +++ b/daemon/test/test.sh @@ -211,7 +211,7 @@ mkdir $DIR1 $DIR2 cat > $DIR1/config < $DIR2/config <