Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
evlekht committed Oct 1, 2024
1 parent c8075e8 commit e3d2502
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
13 changes: 2 additions & 11 deletions internal/messaging/service_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package messaging

import (
"context"
"math/big"
"sync"

"buf.build/gen/go/chain4travel/camino-messenger-protocol/grpc/go/cmp/services/notification/v1/notificationv1grpc"
Expand Down Expand Up @@ -42,12 +41,9 @@ type serviceRegistry struct {
func NewServiceRegistry(supportedServices SupportedServices, logger *zap.SugaredLogger) ServiceRegistry {
services := make(map[types.MessageType]*service, len(supportedServices.ServiceNames))
logStr := "\nSupported services:\n"
for i, serviceName := range supportedServices.ServiceNames {
for _, serviceName := range supportedServices.ServiceNames {
logStr += serviceName + "\n"
services[clients.ServiceNameToRequestType(serviceName)] = &service{
PartnerConfigurationService: supportedServices.Services[i],
name: serviceName,
}
services[clients.ServiceNameToRequestType(serviceName)] = &service{name: serviceName}
}
logStr += "\n"
logger.Info(logStr)
Expand Down Expand Up @@ -94,15 +90,10 @@ type Service interface {
}

type service struct {
cmaccount.PartnerConfigurationService
client clients.Client
name string
}

func (s *service) Fee() *big.Int {
return big.NewInt(0).Set(s.PartnerConfigurationService.Fee)
}

func (s *service) Call(ctx context.Context, request protoreflect.ProtoMessage, opts ...grpc.CallOption) (protoreflect.ProtoMessage, types.MessageType, error) {
return s.client.Call(ctx, request, opts...)
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/matrix/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ func (m *CaminoMatrixMessage) UnmarshalContent(src []byte) error {
switch types.MessageType(m.MsgType) {
case clients.PingServiceV1Request:
m.Content = &pingv1.PingRequest{}
return proto.Unmarshal(src, m.Content)
case clients.PingServiceV1Response:
m.Content = &pingv1.PingResponse{}
return proto.Unmarshal(src, m.Content)
default:
return types.ErrUnknownMessageType
}
return proto.Unmarshal(src, m.Content)
}

func (m *CaminoMatrixMessage) GetChequeFor(addr common.Address) *cheques.SignedCheque {
Expand Down

0 comments on commit e3d2502

Please sign in to comment.