diff --git a/bindings/ldk_node.udl b/bindings/ldk_node.udl index 8a4ffe78a..3b4a43e97 100644 --- a/bindings/ldk_node.udl +++ b/bindings/ldk_node.udl @@ -89,6 +89,7 @@ interface LDKNode { [Throws=NodeError] string sign_message([ByRef]sequence msg); boolean verify_signature([ByRef]sequence msg, [ByRef]string sig, [ByRef]PublicKey pkey); + boolean is_running(); }; [Error] diff --git a/src/lib.rs b/src/lib.rs index a9b1b9cd9..0295650b4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -708,6 +708,11 @@ impl Node { Ok(()) } + /// Returns whether the [`Node`] is running. + pub fn is_running(&self) -> bool { + self.runtime.read().unwrap().is_some() + } + /// Disconnects all peers, stops all running background tasks, and shuts down [`Node`]. /// /// After this returns most API methods will return [`Error::NotRunning`].