[#603] cmd/node: Separate configuration and netmap node info

Config `NodeInfo` should be used for bootstrap. Separete local node info and
netmap one. Return configured `NodeInfo` if structure from netmap is
missing.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-06-11 13:55:11 +03:00 committed by Alex Vanin
parent 5a4c3dfddf
commit 6279b6343f
4 changed files with 60 additions and 84 deletions

View file

@ -365,25 +365,19 @@ type usedSpaceService struct {
}
func (c *cfg) PublicKey() []byte {
ni := c.localNodeInfo()
return ni.PublicKey()
return nodeKeyFromNetmap(c)
}
func (c *cfg) Address() string {
ni := c.localNodeInfo()
return ni.Address()
return nodeAddressFromNetmap(c)
}
func (c *usedSpaceService) PublicKey() []byte {
ni := c.cfg.localNodeInfo()
return ni.PublicKey()
return nodeKeyFromNetmap(c.cfg)
}
func (c *usedSpaceService) Address() string {
ni := c.cfg.localNodeInfo()
return ni.Address()
return nodeAddressFromNetmap(c.cfg)
}
func (c *usedSpaceService) AnnounceUsedSpace(ctx context.Context, req *containerV2.AnnounceUsedSpaceRequest) (*containerV2.AnnounceUsedSpaceResponse, error) {