mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-18 13:27:56 +01:00
refactor: move State server REST registration
This commit moves the registration of the State server with a REST proxy into the `RegisterWithRestProxy` method in order to keep all the REST registrations in one place.
This commit is contained in:
parent
bf5aab9d52
commit
b9560b067a
9
lnd.go
9
lnd.go
@ -901,14 +901,7 @@ func startRestProxy(cfg *Config, rpcServer *rpcServer, restDialOpts []grpc.DialO
|
||||
)
|
||||
|
||||
// Register our services with the REST proxy.
|
||||
err := lnrpc.RegisterStateHandlerFromEndpoint(
|
||||
ctx, mux, restProxyDest, restDialOpts,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = rpcServer.RegisterWithRestProxy(
|
||||
err := rpcServer.RegisterWithRestProxy(
|
||||
ctx, mux, restDialOpts, restProxyDest,
|
||||
)
|
||||
if err != nil {
|
||||
|
@ -906,6 +906,15 @@ func (r *rpcServer) RegisterWithRestProxy(restCtx context.Context,
|
||||
return err
|
||||
}
|
||||
|
||||
// Register our State service with the REST proxy.
|
||||
err = lnrpc.RegisterStateHandlerFromEndpoint(
|
||||
restCtx, restMux, restProxyDest, restDialOpts,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Register all the subservers with the REST proxy.
|
||||
for _, subServer := range r.subGrpcHandlers {
|
||||
err := subServer.RegisterWithRestServer(
|
||||
restCtx, restMux, restProxyDest, restDialOpts,
|
||||
|
Loading…
Reference in New Issue
Block a user