diff --git a/server/v2/cometbft/client/rpc/block.go b/server/v2/cometbft/client/rpc/block.go index ead230b16b87..47ff2a081c28 100644 --- a/server/v2/cometbft/client/rpc/block.go +++ b/server/v2/cometbft/client/rpc/block.go @@ -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 diff --git a/server/v2/cometbft/client/rpc/utils.go b/server/v2/cometbft/client/rpc/utils.go index c41542c9734c..6dfac989b9a1 100644 --- a/server/v2/cometbft/client/rpc/utils.go +++ b/server/v2/cometbft/client/rpc/utils.go @@ -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 {