From d3c1fc7dda92065f3a7112d7b2575a479eb1ddb6 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Tue, 27 Apr 2021 22:18:29 +0300 Subject: [PATCH] [#488] reputation/local/storage: Add trusting peer Fix iteration logic after adding trusting peer in `Trust` struct. Signed-off-by: Pavel Karpy --- cmd/neofs-node/reputation/local/storage.go | 1 + pkg/services/reputation/local/storage/calls.go | 2 +- pkg/services/reputation/local/storage/storage.go | 4 +--- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cmd/neofs-node/reputation/local/storage.go b/cmd/neofs-node/reputation/local/storage.go index 0875b36a..70797093 100644 --- a/cmd/neofs-node/reputation/local/storage.go +++ b/cmd/neofs-node/reputation/local/storage.go @@ -81,6 +81,7 @@ func (it *TrustIterator) Iterate(h reputation.TrustHandler) error { trust := reputation.Trust{} trust.SetPeer(reputation.PeerIDFromBytes(nm.Nodes[i].PublicKey())) trust.SetValue(p) + trust.SetTrustingPeer(reputation.PeerIDFromBytes(it.storage.LocalKey)) if err := h(trust); err != nil { return err diff --git a/pkg/services/reputation/local/storage/calls.go b/pkg/services/reputation/local/storage/calls.go index 04605378..87d5e5d6 100644 --- a/pkg/services/reputation/local/storage/calls.go +++ b/pkg/services/reputation/local/storage/calls.go @@ -47,7 +47,7 @@ type EpochTrustValueStorage struct { func newTrustValueStorage() *EpochTrustValueStorage { return &EpochTrustValueStorage{ - mItems: make(map[string]*trustValue, 1), + mItems: make(map[string]*trustValue, 1), } } diff --git a/pkg/services/reputation/local/storage/storage.go b/pkg/services/reputation/local/storage/storage.go index 4007309d..54e19887 100644 --- a/pkg/services/reputation/local/storage/storage.go +++ b/pkg/services/reputation/local/storage/storage.go @@ -9,9 +9,7 @@ import ( // All values must comply with the requirements imposed on them. // Passing incorrect parameter values will result in constructor // failure (error or panic depending on the implementation). -// -// The component is not parameterizable at the moment. -type Prm struct{} +type Prm struct {} // Storage represents in-memory storage of // local reputation values.