node: expose publicrpc service in admin socket
This makes the publicrpc service available to the admin CLI regardless of whether the publicrpc socket is enabled on the node. Change-Id: If0265f3cd14af44a7f8e9726af796f8879dd7a4b
This commit is contained in:
parent
54b2e51379
commit
4fdfbcdea4
|
@ -4,6 +4,8 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
publicrpcv1 "github.com/certusone/wormhole/bridge/pkg/proto/publicrpc/v1"
|
||||
"github.com/certusone/wormhole/bridge/pkg/publicrpc"
|
||||
"math"
|
||||
"net"
|
||||
"os"
|
||||
|
@ -129,7 +131,7 @@ func (s *nodePrivilegedService) InjectGovernanceVAA(ctx context.Context, req *no
|
|||
return &nodev1.InjectGovernanceVAAResponse{Digest: digest.Bytes()}, nil
|
||||
}
|
||||
|
||||
func adminServiceRunnable(logger *zap.Logger, socketPath string, injectC chan<- *vaa.VAA) (supervisor.Runnable, error) {
|
||||
func adminServiceRunnable(logger *zap.Logger, socketPath string, injectC chan<- *vaa.VAA, hl *publicrpc.RawHeartbeatConns) (supervisor.Runnable, error) {
|
||||
// Delete existing UNIX socket, if present.
|
||||
fi, err := os.Stat(socketPath)
|
||||
if err == nil {
|
||||
|
@ -163,7 +165,10 @@ func adminServiceRunnable(logger *zap.Logger, socketPath string, injectC chan<-
|
|||
logger: logger.Named("adminservice"),
|
||||
}
|
||||
|
||||
publicrpcService := publicrpc.NewPublicrpcServer(logger, hl)
|
||||
|
||||
grpcServer := grpc.NewServer()
|
||||
nodev1.RegisterNodePrivilegedServer(grpcServer, nodeService)
|
||||
publicrpcv1.RegisterPublicrpcServer(grpcServer, publicrpcService)
|
||||
return supervisor.GRPCServer(grpcServer, l, false), nil
|
||||
}
|
||||
|
|
|
@ -353,12 +353,6 @@ func runBridge(cmd *cobra.Command, args []string) {
|
|||
}
|
||||
}
|
||||
|
||||
// local admin service socket
|
||||
adminService, err := adminServiceRunnable(logger, *adminSocketPath, injectC)
|
||||
if err != nil {
|
||||
logger.Fatal("failed to create admin service socket", zap.Error(err))
|
||||
}
|
||||
|
||||
// subscriber channel multiplexing for public gPRC streams
|
||||
rawHeartbeatListeners := publicrpc.HeartbeatStreamMultiplexer(logger)
|
||||
publicrpcService, err := publicrpcServiceRunnable(logger, *publicRPC, rawHeartbeatListeners)
|
||||
|
@ -366,6 +360,12 @@ func runBridge(cmd *cobra.Command, args []string) {
|
|||
log.Fatal("failed to create publicrpc service socket", zap.Error(err))
|
||||
}
|
||||
|
||||
// local admin service socket
|
||||
adminService, err := adminServiceRunnable(logger, *adminSocketPath, injectC, rawHeartbeatListeners)
|
||||
if err != nil {
|
||||
logger.Fatal("failed to create admin service socket", zap.Error(err))
|
||||
}
|
||||
|
||||
// Run supervisor.
|
||||
supervisor.New(rootCtx, logger, func(ctx context.Context) error {
|
||||
if err := supervisor.Run(ctx, "p2p", p2p.Run(
|
||||
|
|
Loading…
Reference in New Issue