Skip to content

Commit

Permalink
fix: panic when totally unbound the validator in voting period
Browse files Browse the repository at this point in the history
  • Loading branch information
j75689 committed Jan 10, 2024
1 parent 9588e44 commit c4d369e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions x/gov/tally.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ func Tally(ctx sdk.Context, keeper Keeper, proposal Proposal) (passes bool, refu
// if delegator tally voting power
valAddrStr := sdk.ValAddress(vote.Voter).String()
if val, ok := currValidators[valAddrStr]; ok {
val.Vote = vote.Option
currValidators[valAddrStr] = val
if val.DelegatorShares.GT(sdk.ZeroDec()) {
val.Vote = vote.Option
currValidators[valAddrStr] = val
}
} else {

keeper.ds.IterateDelegations(ctx, vote.Voter, func(index int64, delegation sdk.Delegation) (stop bool) {
Expand Down

0 comments on commit c4d369e

Please sign in to comment.