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