[#452] innerring: Add reputation processor
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
335b31206f
commit
09e4479d44
3 changed files with 174 additions and 0 deletions
30
pkg/innerring/processors/reputation/process_put.go
Normal file
30
pkg/innerring/processors/reputation/process_put.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package reputation
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
|
||||
"github.com/nspcc-dev/neofs-node/pkg/morph/client/reputation/wrapper"
|
||||
"github.com/nspcc-dev/neofs-node/pkg/services/reputation"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
func (rp *Processor) processPut(epoch uint64, id reputation.PeerID, value []byte) {
|
||||
if !rp.alphabetState.IsAlphabet() {
|
||||
rp.log.Info("non alphabet mode, ignore reputation put notification")
|
||||
return
|
||||
}
|
||||
|
||||
// todo: do sanity checks of value and epoch
|
||||
|
||||
args := wrapper.PutArgs{}
|
||||
args.SetEpoch(epoch)
|
||||
args.SetPeerID(id)
|
||||
args.SetValue(value)
|
||||
|
||||
err := rp.reputationWrp.PutViaNotary(args)
|
||||
if err != nil {
|
||||
rp.log.Warn("can't send approval tx for reputation value",
|
||||
zap.String("peer_id", hex.EncodeToString(id.Bytes())),
|
||||
zap.String("error", err.Error()))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue