Skip to content

Commit

Permalink
go/extra/stats: fix heights at which missing nodes should be queried
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ptrus committed Apr 21, 2020
1 parent 8104502 commit 2136c66
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
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

0 comments on commit 2136c66

Please sign in to comment.