Skip to content

Commit fedc3a5

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 107bf78 commit fedc3a5

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
@@ -335,14 +335,18 @@ impl Node {
335335
//
336336
// TODO: drop 0FC chain source validation when support is ubiquitous
337337
let chain_source = Arc::clone(&self.chain_source);
338-
self.runtime.block_on(async move {
338+
let startup_chain_check_res = self.runtime.block_on(async move {
339339
tokio::try_join!(
340340
chain_source.update_fee_rate_estimates(),
341341
chain_source.validate_zero_fee_commitments_support_if_required(
342342
zero_fee_commitments_support_required
343343
)
344344
)
345-
})?;
345+
});
346+
if let Err(e) = startup_chain_check_res {
347+
self.chain_source.stop();
348+
return Err(e);
349+
}
346350

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

0 commit comments

Comments
 (0)