lightningd: don't keep timer ptr inside struct chain_topology.

It's a legacy from when it didn't have an ld pointer to access ld's
timer structure.  Now it's just confusing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2021-09-01 14:04:24 +09:30 committed by Christian Decker
parent 6d1897b796
commit 395bf96d15
4 changed files with 5 additions and 11 deletions

View File

@ -47,7 +47,7 @@ static void maybe_completed_init(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,
notleak(new_reltimer(topo->ld->timers, topo,
time_from_sec(topo->poll_seconds),
try_extend_tip, topo));
}
@ -583,7 +583,7 @@ AUTODATA(json_command, &parse_feerate_command);
static void next_updatefee_timer(struct chain_topology *topo)
{
/* This takes care of its own lifetime. */
notleak(new_reltimer(topo->timers, topo,
notleak(new_reltimer(topo->ld->timers, topo,
time_from_sec(topo->poll_seconds),
start_fee_estimate, topo));
}
@ -1157,11 +1157,9 @@ static void retry_check_chain(struct chain_topology *topo)
}
void setup_topology(struct chain_topology *topo,
struct timers *timers,
u32 min_blockheight, u32 max_blockheight)
{
memset(&topo->feerate, 0, sizeof(topo->feerate));
topo->timers = timers;
topo->min_blockheight = min_blockheight;
topo->max_blockheight = max_blockheight;

View File

@ -113,9 +113,6 @@ struct chain_topology {
/* The bitcoind. */
struct bitcoind *bitcoind;
/* Our timer list. */
struct timers *timers;
/* Bitcoin transactions we're broadcasting */
struct list_head outgoing_txs;
@ -193,7 +190,7 @@ void broadcast_tx_ahf(struct chain_topology *topo,
const char *err));
struct chain_topology *new_topology(struct lightningd *ld, struct log *log);
void setup_topology(struct chain_topology *topology, struct timers *timers,
void setup_topology(struct chain_topology *topology,
u32 min_blockheight, u32 max_blockheight);
void begin_topology(struct chain_topology *topo);

View File

@ -1035,8 +1035,7 @@ int main(int argc, char *argv[])
/*~ Initialize block topology. This does its own io_loop to
* talk to bitcoind, so does its own db transactions. */
setup_topology(ld->topology, ld->timers,
min_blockheight, max_blockheight);
setup_topology(ld->topology, min_blockheight, max_blockheight);
db_begin_transaction(ld->wallet->db);

View File

@ -202,7 +202,7 @@ void plugins_set_builtin_plugins_dir(struct plugins *plugins UNNEEDED,
void setup_color_and_alias(struct lightningd *ld UNNEEDED)
{ fprintf(stderr, "setup_color_and_alias called!\n"); abort(); }
/* Generated stub for setup_topology */
void setup_topology(struct chain_topology *topology UNNEEDED, struct timers *timers UNNEEDED,
void setup_topology(struct chain_topology *topology UNNEEDED,
u32 min_blockheight UNNEEDED, u32 max_blockheight UNNEEDED)
{ fprintf(stderr, "setup_topology called!\n"); abort(); }
/* Generated stub for timer_expired */