Skip to content

Commit 94a9972

Browse files
committed
mobile: Add ServiceStatus for retrieving current runtime status of lnd
Used for checking whether lnd is started or not. ServiceStatus can also be used to determine when lnd has shut down, since `stopDaemon` returns immediately and does not wait for the gRPC servers to be fully closed.
1 parent 14a01eb commit 94a9972

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

mobile/bindings.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,18 @@ func Start(extraArgs string, rpcReady Callback) {
156156
rpcReady.OnResponse([]byte{})
157157
}()
158158
}
159+
160+
type LndStatusCallback interface {
161+
OnResponse(lndStarted int32)
162+
}
163+
164+
// Returns 1 if lnd has started up successfully, allowing the caller to interact
165+
// with the in-memory gRPC servers. If 0 is returned, the caller should invoke
166+
// `Start` to initialize lnd.
167+
//
168+
// ServiceStatus can also be used to determine when lnd has shut down, since
169+
// `stopDaemon` returns immediately and does not wait for the gRPC servers
170+
// to be fully closed.
171+
func ServiceStatus(callback LndStatusCallback) {
172+
callback.OnResponse(lndStarted)
173+
}

0 commit comments

Comments
 (0)