netmap: extract public key in a separate function
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
2da0ff5750
commit
cac85313ce
1 changed files with 6 additions and 3 deletions
|
@ -142,7 +142,7 @@ func AddPeerIR(nodeInfo []byte) {
|
||||||
|
|
||||||
common.CheckAlphabetWitness()
|
common.CheckAlphabetWitness()
|
||||||
|
|
||||||
publicKey := nodeInfo[2:35] // V2 format: offset:2, len:33
|
publicKey := pubkeyFromNodeInfo(nodeInfo)
|
||||||
|
|
||||||
addToNetmap(ctx, publicKey, Node{
|
addToNetmap(ctx, publicKey, Node{
|
||||||
BLOB: nodeInfo,
|
BLOB: nodeInfo,
|
||||||
|
@ -150,13 +150,16 @@ func AddPeerIR(nodeInfo []byte) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func pubkeyFromNodeInfo(nodeInfo []byte) []byte {
|
||||||
|
return nodeInfo[2:35] // V2 format: offset:2, len:33
|
||||||
|
}
|
||||||
|
|
||||||
// AddPeer accepts information about the network map candidate in the FrostFS
|
// AddPeer accepts information about the network map candidate in the FrostFS
|
||||||
// binary protocol format and does nothing. Keep method because storage node
|
// binary protocol format and does nothing. Keep method because storage node
|
||||||
// creates a notary transaction with this method, which produces a notary
|
// creates a notary transaction with this method, which produces a notary
|
||||||
// notification (implicit here).
|
// notification (implicit here).
|
||||||
func AddPeer(nodeInfo []byte) {
|
func AddPeer(nodeInfo []byte) {
|
||||||
// V2 format - offset:2, len:33
|
common.CheckWitness(pubkeyFromNodeInfo(nodeInfo))
|
||||||
common.CheckWitness(nodeInfo[2:35])
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue