Skip to content

Commit

Permalink
pkg/morph: make read network's magic uint32
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
carpawell committed Sep 6, 2024
1 parent c13f5f4 commit 8163db8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/neofs-node/netmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ type netInfo struct {
netState netmap.State

magic interface {
MagicNumber() (uint64, error)
MagicNumber() (uint32, error)
}

morphClientNetMap *nmClient.Client
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/morph/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,15 +533,15 @@ 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()

if c.inactive {
return 0, ErrConnectionLost
}

return uint64(c.rpcActor.GetNetwork()), nil
return uint32(c.rpcActor.GetNetwork()), nil
}

// BlockCount returns block count of the network
Expand Down

0 comments on commit 8163db8

Please sign in to comment.