Skip to content

Commit

Permalink
compatible range might be nil
Browse files Browse the repository at this point in the history
  • Loading branch information
illia-malachyn committed Oct 9, 2024
1 parent e5a9996 commit 2953c1f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions access/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,13 @@ func (c *BaseClient) GetNodeVersionInfo(ctx context.Context, opts ...grpc.CallOp
return nil, newRPCError(err)
}

var compRange *flow.CompatibleRange
info := res.GetInfo()
compRange := flow.CompatibleRange{
StartHeight: info.CompatibleRange.GetStartHeight(),
EndHeight: info.CompatibleRange.GetEndHeight(),
if info != nil {
compRange = &flow.CompatibleRange{
StartHeight: info.CompatibleRange.GetStartHeight(),
EndHeight: info.CompatibleRange.GetEndHeight(),
}
}

return &flow.NodeVersionInfo{
Expand Down
2 changes: 1 addition & 1 deletion access/grpc/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func TestClient_GetNodeInfo(t *testing.T) {
ProtocolVersion: ver,
SporkRootBlockHeight: spork,
NodeRootBlockHeight: root,
CompatibleRange: flow.CompatibleRange{StartHeight: compRange.StartHeight, EndHeight: compRange.EndHeight},
CompatibleRange: &flow.CompatibleRange{StartHeight: compRange.StartHeight, EndHeight: compRange.EndHeight},
}

rpc.On("GetNodeVersionInfo", ctx, mock.Anything).Return(response, nil)
Expand Down
2 changes: 1 addition & 1 deletion flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ type NodeVersionInfo struct {
ProtocolVersion uint64
SporkRootBlockHeight uint64
NodeRootBlockHeight uint64
CompatibleRange CompatibleRange
CompatibleRange *CompatibleRange
}

type CompatibleRange struct {
Expand Down

0 comments on commit 2953c1f

Please sign in to comment.