Additional GRPC API checks

This commit is contained in:
Angel Valkov 2025-01-08 12:12:52 +02:00
parent 2c453199c8
commit 7ed0bae0ec
No known key found for this signature in database
GPG key ID: EC76DFA3AF588D7E

View file

@ -49,6 +49,10 @@ func (s *Server) HeaderByNumber(ctx context.Context, req *protobor.GetHeaderByNu
return nil, err return nil, err
} }
if header == nil {
return nil, errors.New("header not found")
}
return &protobor.GetHeaderByNumberResponse{Header: headerToProtoborHeader(header)}, nil return &protobor.GetHeaderByNumberResponse{Header: headerToProtoborHeader(header)}, nil
} }
@ -62,6 +66,10 @@ func (s *Server) BlockByNumber(ctx context.Context, req *protobor.GetBlockByNumb
return nil, err return nil, err
} }
if block == nil {
return nil, errors.New("block not found")
}
return &protobor.GetBlockByNumberResponse{Block: blockToProtoBlock(block)}, nil return &protobor.GetBlockByNumberResponse{Block: blockToProtoBlock(block)}, nil
} }