From 754cd8b5790e0880eaf611b7d63ca25677a926fa Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 22 Dec 2020 14:45:33 +0300 Subject: [PATCH] [#255] ir: Replace Server.WriteReport method to another source file Signed-off-by: Leonard Lyubich --- pkg/innerring/innerring.go | 8 -------- pkg/innerring/state.go | 10 ++++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index 8449d8789..3c3499697 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -20,7 +20,6 @@ import ( 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" - auditSvc "github.com/nspcc-dev/neofs-node/pkg/services/audit" audittask "github.com/nspcc-dev/neofs-node/pkg/services/audit/taskmanager" "github.com/nspcc-dev/neofs-node/pkg/util/precision" "github.com/panjf2000/ants/v2" @@ -140,13 +139,6 @@ func (s *Server) Stop() { go s.mainnetListener.Stop() } -func (s *Server) WriteReport(r *auditSvc.Report) error { - res := r.Result() - res.SetPublicKey(s.pubKey) - - return s.auditClient.PutAuditResult(res) -} - // New creates instance of inner ring sever structure. func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error) { var err error diff --git a/pkg/innerring/state.go b/pkg/innerring/state.go index ec0e333e4..d55b413a2 100644 --- a/pkg/innerring/state.go +++ b/pkg/innerring/state.go @@ -3,6 +3,7 @@ package innerring import ( "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neofs-node/pkg/innerring/invoke" + "github.com/nspcc-dev/neofs-node/pkg/services/audit" "go.uber.org/zap" ) @@ -73,3 +74,12 @@ func (s *Server) InitAndVoteForSidechainValidator(validators []keys.PublicKey) e return s.voteForSidechainValidator(validators) } + +// WriteReport composes audit result structure from audit report +// and sends it to Audit contract. +func (s *Server) WriteReport(r *audit.Report) error { + res := r.Result() + res.SetPublicKey(s.pubKey) + + return s.auditClient.PutAuditResult(res) +}