forked from TrueCloudLab/frostfs-node
[#316] ir/netmap: Validate network map candidates in Netmap processor
Define NodeValidator interface of the entity that checks and finalizes NodeInfo structure. Add NodeValidator to Netmap processor. Pass NodeInfo structures of network map candidates to NodeValidator in order to verify it and prepare to final state required by network. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
8a67eea854
commit
cbfaceb956
2 changed files with 34 additions and 0 deletions
|
@ -25,6 +25,16 @@ func (np *Processor) processAddPeer(node []byte) {
|
|||
return
|
||||
}
|
||||
|
||||
// validate and update node info
|
||||
err := np.nodeValidator.VerifyAndUpdate(nodeInfo)
|
||||
if err != nil {
|
||||
np.log.Warn("could not verify and update information about network map candidate",
|
||||
zap.String("error", err.Error()),
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
keyString := hex.EncodeToString(nodeInfo.PublicKey())
|
||||
|
||||
exists := np.netmapSnapshot.touch(keyString, np.epochState.EpochCounter())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue