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/extra/stats: fix heights at which missing nodes should be queried #2858

Merged
merged 1 commit into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changelog/2858.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
go/extra/stats: fix heights at which missing nodes should be queried

If a missing signature is encountered, the registry should be queried at
previous height, since that is the height at which the vote was made.
10 changes: 6 additions & 4 deletions go/extra/stats/cmd/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,11 @@ func getStats(ctx context.Context, consensus consensusAPI.ClientBackend, registr
}
nodeTmAddr := sig.ValidatorAddress.String()

if err := ensureNodeTracking(ctx, stats, nodeTmAddr, height, registry); err != nil {
// Signatures are for previous height.
if err := ensureNodeTracking(ctx, stats, nodeTmAddr, height-1, registry); err != nil {
logger.Error("failed to query registry",
"err", err,
"height", height,
"height", height-1,
)
os.Exit(1)
}
Expand All @@ -294,10 +295,11 @@ func getStats(ctx context.Context, consensus consensusAPI.ClientBackend, registr
if previousProposerAddr != "" {
// Only count round 0 proposals.
if tmBlockMeta.LastCommit.Round == 0 {
if err := ensureNodeTracking(ctx, stats, previousProposerAddr, height, registry); err != nil {
// Proposers are for previous height.
if err := ensureNodeTracking(ctx, stats, previousProposerAddr, height-1, registry); err != nil {
logger.Error("failed to query registry",
"err", err,
"height", height,
"height", height-1,
)
os.Exit(1)
}
Expand Down