refactor(server/v2/cometbft): update function comments (#20506)
This commit is contained in:
parent
6967fbd11e
commit
2e966a8f3e
@ -55,7 +55,7 @@ func QueryBlocks(ctx context.Context, rpcClient CometRPC, page, limit int, query
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// get block by height
|
||||
// GetBlockByHeight gets block by height
|
||||
func GetBlockByHeight(ctx context.Context, rpcClient CometRPC, height *int64) (*v11.Block, error) {
|
||||
// header -> BlockchainInfo
|
||||
// header, tx -> Block
|
||||
@ -76,6 +76,7 @@ func GetBlockByHeight(ctx context.Context, rpcClient CometRPC, height *int64) (*
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// GetBlockByHash gets block by hash
|
||||
func GetBlockByHash(ctx context.Context, rpcClient CometRPC, hashHexString string) (*v11.Block, error) {
|
||||
hash, err := hex.DecodeString(hashHexString)
|
||||
if err != nil {
|
||||
@ -89,8 +90,6 @@ func GetBlockByHash(ctx context.Context, rpcClient CometRPC, hashHexString strin
|
||||
} else if resBlock.Block == nil {
|
||||
return nil, fmt.Errorf("block not found with hash: %s", hashHexString)
|
||||
}
|
||||
|
||||
// TODO: Also move NewResponseResultBlock somewhere around this package
|
||||
out, err := NewResponseResultBlock(resBlock)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@ -61,7 +61,7 @@ func NewResponseResultBlock(res *coretypes.ResultBlock) (*v11.Block, error) {
|
||||
return blk, nil
|
||||
}
|
||||
|
||||
// calculate total pages in an overflow safe manner
|
||||
// calcTotalPages calculates total pages in an overflow safe manner
|
||||
func calcTotalPages(totalCount, limit int64) int64 {
|
||||
totalPages := int64(0)
|
||||
if totalCount != 0 && limit != 0 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user