Merge pull request #1401 from maticnetwork/avalkov/GRPC-API-Checks

Additional GRPC API checks
This commit is contained in:
avalkov 2025-01-08 14:42:41 +02:00 committed by GitHub
commit 14ea2cafbc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
}
@ -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
}