Skip to content

Commit

Permalink
added check for executed disputes to return a zero'ed BlockInfo Object
Browse files Browse the repository at this point in the history
  • Loading branch information
CJPotter10 committed Nov 4, 2024
1 parent f19dc1c commit e5bee93
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion x/dispute/keeper/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper
import (
"context"
"encoding/binary"
"errors"

layertypes "github.com/tellor-io/layer/types"
"github.com/tellor-io/layer/x/dispute/types"
Expand Down Expand Up @@ -78,7 +79,12 @@ func (k Querier) Tally(ctx context.Context, req *types.QueryDisputesTallyRequest
}
blockInfo, err := k.BlockInfo.Get(ctx, dispute.HashId)
if err != nil {
return &types.QueryDisputesTallyResponse{}, err
if errors.Is(err, collections.ErrNotFound) {
blockInfo.TotalReporterPower = math.ZeroInt()
blockInfo.TotalUserTips = math.ZeroInt()
} else {
return &types.QueryDisputesTallyResponse{}, err
}
}

sumOfReporterVotes := voteCounts.Reporters.Against + voteCounts.Reporters.Invalid + voteCounts.Reporters.Support
Expand Down

0 comments on commit e5bee93

Please sign in to comment.