mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
chaintopology: free outstanding requests so we don't get responses while shutting down.
I've never seen this, but the race looks possible so we should close it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
928b7c83fc
commit
9da66100c1
@ -565,7 +565,7 @@ static void start_fee_estimate(struct chain_topology *topo)
|
||||
{
|
||||
topo->updatefee_timer = NULL;
|
||||
/* Based on timer, update fee estimates. */
|
||||
bitcoind_estimate_fees(topo, topo->bitcoind, update_feerates_repeat, NULL);
|
||||
bitcoind_estimate_fees(topo->request_ctx, topo->bitcoind, update_feerates_repeat, NULL);
|
||||
}
|
||||
|
||||
struct rate_conversion {
|
||||
@ -1076,7 +1076,7 @@ static void try_extend_tip(struct chain_topology *topo)
|
||||
{
|
||||
topo->extend_timer = NULL;
|
||||
trace_span_start("extend_tip", topo);
|
||||
bitcoind_getrawblockbyheight(topo, topo->bitcoind, topo->tip->height + 1,
|
||||
bitcoind_getrawblockbyheight(topo->request_ctx, topo->bitcoind, topo->tip->height + 1,
|
||||
get_new_block, topo);
|
||||
}
|
||||
|
||||
@ -1219,6 +1219,7 @@ struct chain_topology *new_topology(struct lightningd *ld, struct logger *log)
|
||||
topo->rebroadcast_timer = NULL;
|
||||
topo->updatefee_timer = NULL;
|
||||
topo->checkchain_timer = NULL;
|
||||
topo->request_ctx = tal(topo, char);
|
||||
list_head_init(topo->sync_waiters);
|
||||
|
||||
return topo;
|
||||
@ -1277,7 +1278,7 @@ static void retry_sync_getchaininfo_done(struct bitcoind *bitcoind, const char *
|
||||
static void retry_sync(struct chain_topology *topo)
|
||||
{
|
||||
topo->checkchain_timer = NULL;
|
||||
bitcoind_getchaininfo(topo, topo->bitcoind, get_block_height(topo),
|
||||
bitcoind_getchaininfo(topo->request_ctx, topo->bitcoind, get_block_height(topo),
|
||||
retry_sync_getchaininfo_done, topo);
|
||||
}
|
||||
|
||||
@ -1500,4 +1501,7 @@ void stop_topology(struct chain_topology *topo)
|
||||
tal_free(topo->checkchain_timer);
|
||||
tal_free(topo->extend_timer);
|
||||
tal_free(topo->updatefee_timer);
|
||||
|
||||
/* Don't handle responses to any existing requests. */
|
||||
tal_free(topo->request_ctx);
|
||||
}
|
||||
|
@ -130,6 +130,9 @@ struct chain_topology {
|
||||
/* Timers we're running. */
|
||||
struct oneshot *checkchain_timer, *extend_timer, *updatefee_timer, *rebroadcast_timer;
|
||||
|
||||
/* Parent context for requests (to bcli plugin) we have outstanding. */
|
||||
tal_t *request_ctx;
|
||||
|
||||
/* Bitcoin transactions we're broadcasting */
|
||||
struct outgoing_tx_map *outgoing_txs;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user