Skip to content

Commit

Permalink
Additional GRPC API checks
Browse files Browse the repository at this point in the history
  • Loading branch information
avalkov committed Jan 8, 2025
1 parent 2c45319 commit 7ed0bae
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions internal/cli/server/api_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func (s *Server) HeaderByNumber(ctx context.Context, req *protobor.GetHeaderByNu
return nil, err
}

if header == nil {
return nil, errors.New("header not found")
}

return &protobor.GetHeaderByNumberResponse{Header: headerToProtoborHeader(header)}, nil
}

Expand All @@ -62,6 +66,10 @@ func (s *Server) BlockByNumber(ctx context.Context, req *protobor.GetBlockByNumb
return nil, err
}

if block == nil {
return nil, errors.New("block not found")
}

return &protobor.GetBlockByNumberResponse{Block: blockToProtoBlock(block)}, nil
}

Expand Down

0 comments on commit 7ed0bae

Please sign in to comment.