[#255] ir: Replace audit client creation to invoke package

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-12-22 14:33:39 +03:00 committed by Alex Vanin
parent 76d4e53ea0
commit 54523d2949
2 changed files with 13 additions and 4 deletions

View file

@ -17,7 +17,6 @@ import (
"github.com/nspcc-dev/neofs-node/pkg/innerring/processors/netmap"
"github.com/nspcc-dev/neofs-node/pkg/innerring/timers"
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
auditClient "github.com/nspcc-dev/neofs-node/pkg/morph/client/audit"
auditWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/audit/wrapper"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
"github.com/nspcc-dev/neofs-node/pkg/morph/subscriber"
@ -220,13 +219,11 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error
return nil, err
}
staticAuditClient, err := client.NewStatic(server.morphClient, server.contracts.audit, 0)
server.auditClient, err = invoke.NewNoFeeAuditClient(server.morphClient, server.contracts.audit)
if err != nil {
return nil, err
}
server.auditClient = auditWrapper.WrapClient(auditClient.New(staticAuditClient))
auditTaskManager := audittask.New(
audittask.WithQueueCapacity(cfg.GetUint32("audit.task.queue_capacity")),
audittask.WithWorkerPool(auditPool),

View file

@ -5,6 +5,8 @@ import (
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neofs-node/pkg/morph/client"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/audit"
auditWrapper "github.com/nspcc-dev/neofs-node/pkg/morph/client/audit/wrapper"
morphContainer "github.com/nspcc-dev/neofs-node/pkg/morph/client/container"
wrapContainer "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
morphNetmap "github.com/nspcc-dev/neofs-node/pkg/morph/client/netmap"
@ -42,3 +44,13 @@ func NewNoFeeNetmapClient(cli *client.Client, contract util.Uint160) (*wrapNetma
return wrapNetmap.New(enhancedNetmapClient)
}
// NewNoFeeAuditClient creates wrapper to work with Audit contract.
func NewNoFeeAuditClient(cli *client.Client, contract util.Uint160) (*auditWrapper.ClientWrapper, error) {
staticClient, err := client.NewStatic(cli, contract, readOnlyFee)
if err != nil {
return nil, err
}
return auditWrapper.WrapClient(audit.New(staticClient)), nil
}