frostfs-node/cmd/neofs-node/accounting.go
Evgenii Stratonikov 3f07313604 [#562] cmd/neofs-node: use NEP-6 wallet for keys
Also use neo-go private key wrapper where possible, as it
already has methods for (un)marshaling.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-06-15 14:49:59 +03:00

32 lines
971 B
Go

package main
import (
accountingGRPC "github.com/nspcc-dev/neofs-api-go/v2/accounting/grpc"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/balance/wrapper"
accountingTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/accounting/grpc"
accountingService "github.com/nspcc-dev/neofs-node/pkg/services/accounting"
accounting "github.com/nspcc-dev/neofs-node/pkg/services/accounting/morph"
)
func initAccountingService(c *cfg) {
if c.cfgMorph.client == nil {
initMorphComponents(c)
}
balanceMorphWrapper, err := wrapper.NewFromMorph(c.cfgMorph.client, c.cfgAccounting.scriptHash, 0)
fatalOnErr(err)
accountingGRPC.RegisterAccountingServiceServer(c.cfgGRPC.server,
accountingTransportGRPC.New(
accountingService.NewSignService(
&c.key.PrivateKey,
accountingService.NewResponseService(
accountingService.NewExecutionService(
accounting.NewExecutor(balanceMorphWrapper),
),
c.respSvc,
),
),
),
)
}