Skip to content

Commit 05efb2f

Browse files
committed
Stop the chain source upon startup checks failure
This is particularly relevant for the electrum chain source; if we fail to fetch feerates, or zero fee commitments validation fails, and we do not stop the electrum chain source before returning an error, then the user will hit a debug assertion on the next restart.
1 parent 3da69d8 commit 05efb2f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/lib.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,14 +336,18 @@ impl Node {
336336
//
337337
// TODO: drop 0FC chain source validation when support is ubiquitous
338338
let chain_source = Arc::clone(&self.chain_source);
339-
self.runtime.block_on(async move {
339+
let startup_chain_check_res = self.runtime.block_on(async move {
340340
tokio::try_join!(
341341
chain_source.update_fee_rate_estimates(),
342342
chain_source.validate_zero_fee_commitments_support_if_required(
343343
zero_fee_commitments_support_required
344344
)
345345
)
346-
})?;
346+
});
347+
if let Err(e) = startup_chain_check_res {
348+
self.chain_source.stop();
349+
return Err(e);
350+
}
347351

348352
// Spawn background task continuously syncing onchain, lightning, and fee rate cache.
349353
let stop_sync_receiver = self.stop_sender.subscribe();

0 commit comments

Comments
 (0)