[#488] reputation/local/storage: Add trusting peer

Fix iteration logic after adding trusting peer
in `Trust` struct.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-04-27 22:18:29 +03:00 committed by Alex Vanin
parent dbff8e9b3f
commit d3c1fc7dda
3 changed files with 3 additions and 4 deletions

View file

@ -81,6 +81,7 @@ func (it *TrustIterator) Iterate(h reputation.TrustHandler) error {
trust := reputation.Trust{} trust := reputation.Trust{}
trust.SetPeer(reputation.PeerIDFromBytes(nm.Nodes[i].PublicKey())) trust.SetPeer(reputation.PeerIDFromBytes(nm.Nodes[i].PublicKey()))
trust.SetValue(p) trust.SetValue(p)
trust.SetTrustingPeer(reputation.PeerIDFromBytes(it.storage.LocalKey))
if err := h(trust); err != nil { if err := h(trust); err != nil {
return err return err

View file

@ -9,9 +9,7 @@ import (
// All values must comply with the requirements imposed on them. // All values must comply with the requirements imposed on them.
// Passing incorrect parameter values will result in constructor // Passing incorrect parameter values will result in constructor
// failure (error or panic depending on the implementation). // failure (error or panic depending on the implementation).
// type Prm struct {}
// The component is not parameterizable at the moment.
type Prm struct{}
// Storage represents in-memory storage of // Storage represents in-memory storage of
// local reputation values. // local reputation values.