[#504] reputation/intermediate: Add reading alpha from global cfg

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-05-06 00:03:07 +03:00 committed by Alex Vanin
parent 7319ca5a00
commit bd6d5e7f7b
2 changed files with 1 additions and 15 deletions

View file

@ -37,8 +37,6 @@ import (
"go.uber.org/zap" "go.uber.org/zap"
) )
const EigenTrustAlpha = 0.1
func initReputationService(c *cfg) { func initReputationService(c *cfg) {
staticClient, err := client.NewStatic( staticClient, err := client.NewStatic(
c.cfgMorph.client, c.cfgMorph.client,
@ -149,9 +147,7 @@ func initReputationService(c *cfg) {
eigenTrustCalculator := eigentrustcalc.New( eigenTrustCalculator := eigentrustcalc.New(
eigentrustcalc.Prm{ eigentrustcalc.Prm{
AlphaProvider: intermediate.AlphaProvider{ AlphaProvider: c.cfgNetmap.wrapper,
Alpha: EigenTrustAlpha,
},
InitialTrustSource: intermediatereputation.InitialTrustSource{ InitialTrustSource: intermediatereputation.InitialTrustSource{
NetMap: nmSrc, NetMap: nmSrc,
}, },

View file

@ -53,13 +53,3 @@ func (c *DaughtersTrustCalculator) Calculate(ctx eigentrustctrl.IterationContext
c.Calculator.Calculate(calcPrm) c.Calculator.Calculate(calcPrm)
} }
// AlphaProvider provides required alpha parameter of eigen trust algorithm.
// TODO: decide if `Alpha` should be dynamically read from global config. #497
type AlphaProvider struct {
Alpha float64
}
func (ap AlphaProvider) EigenTrustAlpha() (float64, error) {
return ap.Alpha, nil
}