Browse Source

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 <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 9 years ago
parent
commit
fe1ba96332
  1. 2
      daemon/chaintopology.c
  2. 10
      daemon/lightningd.c
  3. 4
      daemon/lightningd.h
  4. 4
      daemon/test/test.sh

2
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) 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); start_poll_chaintips, dstate);
} }

10
daemon/lightningd.c

@ -5,6 +5,7 @@
#include "jsonrpc.h" #include "jsonrpc.h"
#include "lightningd.h" #include "lightningd.h"
#include "log.h" #include "log.h"
#include "opt_time.h"
#include "peer.h" #include "peer.h"
#include "secrets.h" #include "secrets.h"
#include "timeout.h" #include "timeout.h"
@ -14,6 +15,7 @@
#include <ccan/opt/opt.h> #include <ccan/opt/opt.h>
#include <ccan/tal/str/str.h> #include <ccan/tal/str/str.h>
#include <ccan/tal/tal.h> #include <ccan/tal/tal.h>
#include <ccan/time/time.h>
#include <ccan/timer/timer.h> #include <ccan/timer/timer.h>
#include <errno.h> #include <errno.h>
#include <inttypes.h> #include <inttypes.h>
@ -98,9 +100,9 @@ static void config_register_opts(struct lightningd_state *dstate)
opt_register_arg("--max-expiry", opt_set_u32, opt_show_u32, opt_register_arg("--max-expiry", opt_set_u32, opt_show_u32,
&dstate->config.max_expiry, &dstate->config.max_expiry,
"Maximum number of seconds to accept an HTLC before expiry"); "Maximum number of seconds to accept an HTLC before expiry");
opt_register_arg("--bitcoind-poll", opt_set_u32, opt_show_u32, opt_register_arg("--bitcoind-poll", opt_set_time, opt_show_time,
&dstate->config.poll_seconds, &dstate->config.poll_time,
"Seconds between polling for new transactions"); "Time between polling for new transactions");
} }
#define MINUTES 60 #define MINUTES 60
@ -151,7 +153,7 @@ static void default_config(struct config *config)
/* Don't lock up channel for more than 5 days. */ /* Don't lock up channel for more than 5 days. */
config->max_expiry = 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) static void check_config(struct lightningd_state *dstate)

4
daemon/lightningd.h

@ -41,8 +41,8 @@ struct config {
/* Minimum/maximum time for an expiring HTLC (seconds). */ /* Minimum/maximum time for an expiring HTLC (seconds). */
u32 min_expiry, max_expiry; u32 min_expiry, max_expiry;
/* How long (seconds) between polling bitcoind. */ /* How long between polling bitcoind. */
u32 poll_seconds; struct timerel poll_time;
}; };
/* Here's where the global variables hide! */ /* Here's where the global variables hide! */

4
daemon/test/test.sh

@ -211,7 +211,7 @@ mkdir $DIR1 $DIR2
cat > $DIR1/config <<EOF cat > $DIR1/config <<EOF
log-level=debug log-level=debug
bitcoind-poll=1 bitcoind-poll=1s
min-expiry=900 min-expiry=900
bitcoin-datadir=$DATADIR bitcoin-datadir=$DATADIR
locktime=600 locktime=600
@ -219,7 +219,7 @@ EOF
cat > $DIR2/config <<EOF cat > $DIR2/config <<EOF
log-level=debug log-level=debug
bitcoind-poll=1 bitcoind-poll=1s
min-expiry=900 min-expiry=900
bitcoin-datadir=$DATADIR bitcoin-datadir=$DATADIR
locktime=600 locktime=600

Loading…
Cancel
Save