[#527] reputation: Fix EigenTrust algorithm
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
e1e4a61ba7
commit
9fbc6f5efe
2 changed files with 2 additions and 1 deletions
|
@ -62,6 +62,7 @@ func (it *TrustIterator) Iterate(h reputation.TrustHandler) error {
|
||||||
for i := range nm.Nodes {
|
for i := range nm.Nodes {
|
||||||
if bytes.Equal(nm.Nodes[i].PublicKey(), it.storage.LocalKey) {
|
if bytes.Equal(nm.Nodes[i].PublicKey(), it.storage.LocalKey) {
|
||||||
localIndex = i
|
localIndex = i
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ func (s *EpochTrustValueStorage) Iterate(h reputation.TrustHandler) (err error)
|
||||||
t := reputation.Trust{}
|
t := reputation.Trust{}
|
||||||
|
|
||||||
t.SetPeer(peerIDFromString(strID))
|
t.SetPeer(peerIDFromString(strID))
|
||||||
t.SetValue(val)
|
t.SetValue(val.Div(sum))
|
||||||
|
|
||||||
if err = h(t); err != nil {
|
if err = h(t); err != nil {
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue