From 2136c665a42af2d8b16568460f314d69fc42bc3e Mon Sep 17 00:00:00 2001 From: ptrus Date: Tue, 21 Apr 2020 14:02:28 +0200 Subject: [PATCH] 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. --- .changelog/2858.bugfix.md | 4 ++++ go/extra/stats/cmd/stats.go | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .changelog/2858.bugfix.md diff --git a/.changelog/2858.bugfix.md b/.changelog/2858.bugfix.md new file mode 100644 index 00000000000..7b0c928d287 --- /dev/null +++ b/.changelog/2858.bugfix.md @@ -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. diff --git a/go/extra/stats/cmd/stats.go b/go/extra/stats/cmd/stats.go index a25faa4dbb1..07d1583d1f4 100644 --- a/go/extra/stats/cmd/stats.go +++ b/go/extra/stats/cmd/stats.go @@ -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) } @@ -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) }