mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
Additional GRPC API checks
This commit is contained in:
parent
2c453199c8
commit
7ed0bae0ec
1 changed files with 8 additions and 0 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue