Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/control/GetStatus: include the latest epoch #3753

Merged
merged 1 commit into from
Mar 4, 2021
Merged

Conversation

ptrus
Copy link
Member

@ptrus ptrus commented Mar 4, 2021

Fixes: #3743

// Latest block epoch.
epoch, err := t.beacon.GetEpoch(ctx, status.LatestHeight)
if err != nil {
return nil, fmt.Errorf("failed to fetch epoch: %w", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this fail when there's no committed blocks? Maybe it should only query the epoch in case if successfully fetches the block above.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this was actually caught by the early query E2E test :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😁 oh yeah i thought we'll fail early above if there's no committed block, missed the exception.

@@ -788,6 +788,11 @@ func (t *fullService) GetStatus(ctx context.Context) (*consensusAPI.Status, erro
status.LatestHash = latestBlk.Hash
status.LatestTime = latestBlk.Time
status.LatestStateRoot = latestBlk.StateRoot
epoch, err := t.beacon.GetEpoch(ctx, status.LatestHeight)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add an empty line above.

@ptrus ptrus merged commit 4a096ad into master Mar 4, 2021
@ptrus ptrus deleted the ptrus/status/epoch branch March 4, 2021 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GetStatus endpoint should include the current epoch
2 participants