Skip to content

Commit

Permalink
api: make epoch end height optional
Browse files Browse the repository at this point in the history
  • Loading branch information
mitjat committed Jan 10, 2023
1 parent b13917e commit 8247a6c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions api/spec/v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ components:
Epoch:
type: object
required: [id, start_height, end_height]
required: [id, start_height]
properties:
id:
x-go-name: ID
Expand All @@ -1441,7 +1441,7 @@ components:
end_height:
type: integer
format: uint64
description: The (inclusive) height at which this epoch ended.
description: The (inclusive) height at which this epoch ended. Omitted if the epoch is still active.
example: *block_height_2
description: |
A consensus epoch.
Expand Down
4 changes: 2 additions & 2 deletions api/v1/types/openapi.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions storage/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -850,17 +850,13 @@ func (c *StorageClient) Epochs(ctx context.Context, p *apiCommon.Pagination) (*E
}
for rows.Next() {
var e Epoch
var endHeight *uint64
if err := rows.Scan(&e.ID, &e.StartHeight, &endHeight); err != nil {
if err := rows.Scan(&e.ID, &e.StartHeight, &e.EndHeight); err != nil {
c.logger.Info("row scan failed",
"request_id", ctx.Value(common.RequestIDContextKey),
"err", err.Error(),
)
return nil, apiCommon.ErrStorageError
}
if endHeight != nil {
e.EndHeight = *endHeight
}

es.Epochs = append(es.Epochs, e)
}
Expand Down

0 comments on commit 8247a6c

Please sign in to comment.