Skip to content

Commit 6624206

Browse files
committed
fix(cbf): stop chain source before waiting on tasks
- Stop runtime-dependent chain sources before waiting for non-cancellable background tasks. - Allow the CBF requester shutdown to unblock the node run loop during Node::stop.
1 parent 304f69f commit 6624206

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -727,13 +727,15 @@ impl Node {
727727
self.peer_manager.disconnect_all_peers();
728728
log_debug!(self.logger, "Disconnected all network peers.");
729729

730-
// Wait until non-cancellable background tasks (mod LDK's background processor) are done.
731-
self.runtime.wait_on_background_tasks();
732-
733-
// Stop any runtime-dependant chain sources.
730+
// Stop any runtime-dependant chain sources before waiting on non-cancellable
731+
// background tasks. Some chain sources own background tasks that only exit
732+
// after their client/requester is shut down.
734733
self.chain_source.stop();
735734
log_debug!(self.logger, "Stopped chain sources.");
736735

736+
// Wait until non-cancellable background tasks (mod LDK's background processor) are done.
737+
self.runtime.wait_on_background_tasks();
738+
737739
// Stop the background processor.
738740
self.background_processor_stop_sender
739741
.send(())

0 commit comments

Comments
 (0)