From 8163db8155b7e44aecd4387e9e2a3f0a868bacd7 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Fri, 6 Sep 2024 19:11:41 +0300 Subject: [PATCH] pkg/morph: make read network's magic `uint32` When I wanted to use it, I wrote all the code based on `uint32` (because I knew it should be this way), and at the last moment I found that `client` package returns it as `uint64` for no reason. Signed-off-by: Pavel Karpy --- cmd/neofs-node/netmap.go | 4 ++-- pkg/morph/client/client.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/neofs-node/netmap.go b/cmd/neofs-node/netmap.go index 575b88e76f..856dc82bee 100644 --- a/cmd/neofs-node/netmap.go +++ b/cmd/neofs-node/netmap.go @@ -388,7 +388,7 @@ type netInfo struct { netState netmap.State magic interface { - MagicNumber() (uint64, error) + MagicNumber() (uint32, error) } morphClientNetMap *nmClient.Client @@ -404,7 +404,7 @@ func (n *netInfo) Dump(ver version.Version) (*netmapSDK.NetworkInfo, error) { var ni netmapSDK.NetworkInfo ni.SetCurrentEpoch(n.netState.CurrentEpoch()) - ni.SetMagicNumber(magic) + ni.SetMagicNumber(uint64(magic)) netInfoMorph, err := n.morphClientNetMap.ReadNetworkConfiguration() if err != nil { diff --git a/pkg/morph/client/client.go b/pkg/morph/client/client.go index 486b16f09e..e9c4bf8cfe 100644 --- a/pkg/morph/client/client.go +++ b/pkg/morph/client/client.go @@ -533,7 +533,7 @@ func (c *Client) roleList(r noderoles.Role) (keys.PublicKeys, error) { // MagicNumber returns the magic number of the network // to which the underlying RPC node client is connected. -func (c *Client) MagicNumber() (uint64, error) { +func (c *Client) MagicNumber() (uint32, error) { c.switchLock.RLock() defer c.switchLock.RUnlock() @@ -541,7 +541,7 @@ func (c *Client) MagicNumber() (uint64, error) { return 0, ErrConnectionLost } - return uint64(c.rpcActor.GetNetwork()), nil + return uint32(c.rpcActor.GetNetwork()), nil } // BlockCount returns block count of the network