[#1184] node: Add audit middleware for grpc services

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2024-06-18 12:40:03 +03:00
parent ac1f014747
commit ecd1ed7a5e
16 changed files with 967 additions and 36 deletions

View file

@ -20,15 +20,16 @@ func initAccountingService(ctx context.Context, c *cfg) {
balanceMorphWrapper, err := balance.NewFromMorph(c.cfgMorph.client, c.cfgAccounting.scriptHash, 0)
fatalOnErr(err)
server := accountingTransportGRPC.New(
accountingService.NewSignService(
&c.key.PrivateKey,
accountingService.NewExecutionService(
accounting.NewExecutor(balanceMorphWrapper),
c.respSvc,
),
service := accountingService.NewSignService(
&c.key.PrivateKey,
accountingService.NewExecutionService(
accounting.NewExecutor(balanceMorphWrapper),
c.respSvc,
),
)
service = accountingService.NewAuditService(service, c.log, c.audit)
server := accountingTransportGRPC.New(service)
c.cfgGRPC.performAndSave(func(_ string, _ net.Listener, s *grpc.Server) {
accountingGRPC.RegisterAccountingServiceServer(s, server)