Skip to content

Commit 3ef0f3b

Browse files
committed
Stop the chain source upon any startup failure
This is particularly relevant for the electrum chain source; if we fail startup, 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. Further work remains to properly wind down all spawned tasks on any startup error, this will be addressed in a subsequent PR.
1 parent 0e76fe8 commit 3ef0f3b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,16 @@ impl Node {
292292
return Err(Error::AlreadyRunning);
293293
}
294294

295+
match self.start_inner(&mut is_running_lock) {
296+
Ok(()) => Ok(()),
297+
Err(e) => {
298+
self.chain_source.stop();
299+
Err(e)
300+
},
301+
}
302+
}
303+
304+
fn start_inner(&self, is_running_lock: &mut bool) -> Result<(), Error> {
295305
log_info!(
296306
self.logger,
297307
"Starting up LDK Node with node ID {} on network: {}",

0 commit comments

Comments
 (0)