mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
Merge pull request #1401 from maticnetwork/avalkov/GRPC-API-Checks
Additional GRPC API checks
This commit is contained in:
commit
14ea2cafbc
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