mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
option cleanup: --dev-bitcoind-poll
Make --bitcoind-poll a dev option. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
adbe02c6be
commit
c8cc8fd83f
@ -24,7 +24,8 @@ static void try_extend_tip(struct chain_topology *topo);
|
||||
static void next_topology_timer(struct chain_topology *topo)
|
||||
{
|
||||
/* This takes care of its own lifetime. */
|
||||
notleak(new_reltimer(topo->timers, topo, topo->poll_time,
|
||||
notleak(new_reltimer(topo->timers, topo,
|
||||
time_from_sec(topo->poll_seconds),
|
||||
try_extend_tip, topo));
|
||||
}
|
||||
|
||||
@ -331,7 +332,8 @@ static void start_fee_estimate(struct chain_topology *topo)
|
||||
static void next_updatefee_timer(struct chain_topology *topo)
|
||||
{
|
||||
/* This takes care of its own lifetime. */
|
||||
notleak(new_reltimer(topo->timers, topo, topo->poll_time,
|
||||
notleak(new_reltimer(topo->timers, topo,
|
||||
time_from_sec(topo->poll_seconds),
|
||||
start_fee_estimate, topo));
|
||||
}
|
||||
|
||||
@ -720,16 +722,16 @@ struct chain_topology *new_topology(struct lightningd *ld, struct log *log)
|
||||
topo->override_fee_rate = NULL;
|
||||
topo->bitcoind = new_bitcoind(topo, ld, log);
|
||||
topo->wallet = ld->wallet;
|
||||
topo->poll_seconds = 30;
|
||||
return topo;
|
||||
}
|
||||
|
||||
void setup_topology(struct chain_topology *topo,
|
||||
struct timers *timers,
|
||||
struct timerel poll_time, u32 first_blocknum)
|
||||
u32 first_blocknum)
|
||||
{
|
||||
memset(&topo->feerate, 0, sizeof(topo->feerate));
|
||||
topo->timers = timers;
|
||||
topo->poll_time = poll_time;
|
||||
|
||||
topo->first_blocknum = first_blocknum;
|
||||
|
||||
|
@ -93,7 +93,7 @@ struct chain_topology {
|
||||
unsigned int first_blocknum;
|
||||
|
||||
/* How often to poll. */
|
||||
struct timerel poll_time;
|
||||
u32 poll_seconds;
|
||||
|
||||
/* The bitcoind. */
|
||||
struct bitcoind *bitcoind;
|
||||
@ -150,7 +150,7 @@ void broadcast_tx(struct chain_topology *topo,
|
||||
struct chain_topology *new_topology(struct lightningd *ld, struct log *log);
|
||||
void setup_topology(struct chain_topology *topology,
|
||||
struct timers *timers,
|
||||
struct timerel poll_time, u32 first_channel_block);
|
||||
u32 first_channel_block);
|
||||
|
||||
void begin_topology(struct chain_topology *topo);
|
||||
|
||||
|
@ -395,7 +395,6 @@ int main(int argc, char *argv[])
|
||||
/* Initialize block topology (does its own transaction) */
|
||||
setup_topology(ld->topology,
|
||||
&ld->timers,
|
||||
ld->config.poll_time,
|
||||
blockheight);
|
||||
|
||||
/* Create RPC socket (if any) */
|
||||
|
@ -51,9 +51,6 @@ struct config {
|
||||
u32 fee_base;
|
||||
s32 fee_per_satoshi;
|
||||
|
||||
/* How long between polling bitcoind. */
|
||||
struct timerel poll_time;
|
||||
|
||||
/* How long between changing commit and sending COMMIT message. */
|
||||
struct timerel commit_time;
|
||||
|
||||
|
@ -360,9 +360,6 @@ static void config_register_opts(struct lightningd *ld)
|
||||
opt_register_arg("--max-htlc-expiry", opt_set_u32, opt_show_u32,
|
||||
&ld->config.max_htlc_expiry,
|
||||
"Maximum number of blocks to accept an HTLC before expiry");
|
||||
opt_register_arg("--bitcoind-poll", opt_set_time, opt_show_time,
|
||||
&ld->config.poll_time,
|
||||
"Time between polling for new transactions");
|
||||
opt_register_arg("--commit-time", opt_set_time, opt_show_time,
|
||||
&ld->config.commit_time,
|
||||
"Time after changes before sending out COMMIT");
|
||||
@ -447,6 +444,9 @@ static void dev_register_opts(struct lightningd *ld)
|
||||
opt_register_noarg("--dev-allow-localhost", opt_set_bool,
|
||||
&ld->dev_allow_localhost,
|
||||
"Announce and allow announcments for localhost address");
|
||||
opt_register_arg("--dev-bitcoind-poll", opt_set_u32, opt_show_u32,
|
||||
&ld->topology->poll_seconds,
|
||||
"Time between polling for new transactions");
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -480,9 +480,6 @@ static const struct config testnet_config = {
|
||||
/* Don't lock up channel for more than 5 days. */
|
||||
.max_htlc_expiry = 5 * 6 * 24,
|
||||
|
||||
/* How often to bother bitcoind. */
|
||||
.poll_time = TIME_FROM_SEC(10),
|
||||
|
||||
/* Send commit 10msec after receiving; almost immediately. */
|
||||
.commit_time = TIME_FROM_MSEC(10),
|
||||
|
||||
@ -544,9 +541,6 @@ static const struct config mainnet_config = {
|
||||
/* Don't lock up channel for more than 5 days. */
|
||||
.max_htlc_expiry = 5 * 6 * 24,
|
||||
|
||||
/* How often to bother bitcoind. */
|
||||
.poll_time = TIME_FROM_SEC(30),
|
||||
|
||||
/* Send commit 10msec after receiving; almost immediately. */
|
||||
.commit_time = TIME_FROM_MSEC(10),
|
||||
|
||||
|
@ -96,7 +96,7 @@ void setup_jsonrpc(struct lightningd *ld UNNEEDED, const char *rpc_filename UNNE
|
||||
/* Generated stub for setup_topology */
|
||||
void setup_topology(struct chain_topology *topology UNNEEDED,
|
||||
struct timers *timers UNNEEDED,
|
||||
struct timerel poll_time UNNEEDED, u32 first_channel_block UNNEEDED)
|
||||
u32 first_channel_block UNNEEDED)
|
||||
{ fprintf(stderr, "setup_topology called!\n"); abort(); }
|
||||
/* Generated stub for subd_shutdown */
|
||||
void subd_shutdown(struct subd *subd UNNEEDED, unsigned int seconds UNNEEDED)
|
||||
|
@ -19,7 +19,6 @@ BITCOIND_CONFIG = {
|
||||
|
||||
|
||||
LIGHTNINGD_CONFIG = {
|
||||
"bitcoind-poll": "1s",
|
||||
"log-level": "debug",
|
||||
"cltv-delta": 6,
|
||||
"cltv-final": 5,
|
||||
@ -282,6 +281,7 @@ class LightningD(TailableProc):
|
||||
f.write(seed)
|
||||
if DEVELOPER:
|
||||
self.opts['dev-broadcast-interval'] = 1000
|
||||
self.opts['dev-bitcoind-poll'] = 1
|
||||
# lightningd won't announce non-routable addresses by default.
|
||||
self.opts['dev-allow-localhost'] = None
|
||||
self.prefix = 'lightningd-%d' % (node_id)
|
||||
|
Loading…
Reference in New Issue
Block a user