Skip to content

Commit 0181500

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 0d78371 commit 0181500

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
@@ -735,13 +735,15 @@ impl Node {
735735
self.peer_manager.disconnect_all_peers();
736736
log_debug!(self.logger, "Disconnected all network peers.");
737737

738-
// Wait until non-cancellable background tasks (mod LDK's background processor) are done.
739-
self.runtime.wait_on_background_tasks();
740-
741-
// Stop any runtime-dependant chain sources.
738+
// Stop any runtime-dependant chain sources before waiting on non-cancellable
739+
// background tasks. Some chain sources own background tasks that only exit
740+
// after their client/requester is shut down.
742741
self.chain_source.stop();
743742
log_debug!(self.logger, "Stopped chain sources.");
744743

744+
// Wait until non-cancellable background tasks (mod LDK's background processor) are done.
745+
self.runtime.wait_on_background_tasks();
746+
745747
// Stop the background processor.
746748
self.background_processor_stop_sender
747749
.send(())

0 commit comments

Comments
 (0)