forked from TrueCloudLab/frostfs-node
[#1513] node: Encode node's public key into binary format once
Avoid per-iteration key encoding due to the immutability of the key. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
4574ba646d
commit
eb7b8bf7c4
2 changed files with 11 additions and 8 deletions
|
@ -77,6 +77,8 @@ type cfg struct {
|
|||
|
||||
key *keys.PrivateKey
|
||||
|
||||
binPublicKey []byte
|
||||
|
||||
ownerIDFromKey user.ID // user ID calculated from key
|
||||
|
||||
apiVersion version.Version
|
||||
|
@ -275,6 +277,7 @@ func initCfg(path string) *cfg {
|
|||
log: log,
|
||||
wg: new(sync.WaitGroup),
|
||||
key: key,
|
||||
binPublicKey: key.PublicKey().Bytes(),
|
||||
apiVersion: version.Current(),
|
||||
cfgAccounting: cfgAccounting{
|
||||
scriptHash: contractsconfig.Balance(appCfg),
|
||||
|
|
|
@ -288,7 +288,7 @@ func (c *cfg) netmapLocalNodeState(epoch uint64) (*netmapSDK.NodeInfo, error) {
|
|||
|
||||
nmNodes := nm.Nodes()
|
||||
for i := range nmNodes {
|
||||
if bytes.Equal(nmNodes[i].PublicKey(), c.key.PublicKey().Bytes()) {
|
||||
if bytes.Equal(nmNodes[i].PublicKey(), c.binPublicKey) {
|
||||
return &nmNodes[i], nil
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue