mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 18:10:34 +01:00
4ea494e8c5
In order to be able to register the subservers with the root grpc server before we have all dependencies available, we wrap them in an GrpcHandler struct. This struct will initially hold an empty reference to the subservers, which allows us to register with the GRPC server, and later populate and create the subserver instance.
24 lines
494 B
Go
24 lines
494 B
Go
package verrpc
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/lightningnetwork/lnd/lnrpc"
|
|
)
|
|
|
|
func init() {
|
|
subServer := &lnrpc.SubServerDriver{
|
|
SubServerName: subServerName,
|
|
NewGrpcHandler: func() lnrpc.GrpcHandler {
|
|
return &ServerShell{}
|
|
},
|
|
}
|
|
|
|
// We'll register ourselves as a sub-RPC server within the global lnrpc
|
|
// package namespace.
|
|
if err := lnrpc.RegisterSubServer(subServer); err != nil {
|
|
panic(fmt.Sprintf("failed to register sub server driver '%s': %v",
|
|
subServerName, err))
|
|
}
|
|
}
|