[#527] reputation: Fix EigenTrust algorithm

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-05-13 20:19:06 +03:00 committed by Alex Vanin
parent e1e4a61ba7
commit 9fbc6f5efe
2 changed files with 2 additions and 1 deletions

View file

@ -62,6 +62,7 @@ func (it *TrustIterator) Iterate(h reputation.TrustHandler) error {
for i := range nm.Nodes {
if bytes.Equal(nm.Nodes[i].PublicKey(), it.storage.LocalKey) {
localIndex = i
break
}
}

View file

@ -158,7 +158,7 @@ func (s *EpochTrustValueStorage) Iterate(h reputation.TrustHandler) (err error)
t := reputation.Trust{}
t.SetPeer(peerIDFromString(strID))
t.SetValue(val)
t.SetValue(val.Div(sum))
if err = h(t); err != nil {
break