Skip to content

Commit

Permalink
fix: remove validator info after hook
Browse files Browse the repository at this point in the history
  • Loading branch information
javiersuweijie committed Jul 21, 2023
1 parent a1bc98f commit 1cdf4e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion x/alliance/keeper/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ func (h Hooks) BeforeValidatorModified(_ sdk.Context, _ sdk.ValAddress) error {
return nil
}

func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error {
func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, _ sdk.ConsAddress, valAddr sdk.ValAddress) error {
h.k.DeleteValidatorInfo(ctx, valAddr)
h.k.QueueAssetRebalanceEvent(ctx)
return nil
}
Expand Down
6 changes: 6 additions & 0 deletions x/alliance/keeper/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@ func (k Keeper) GetAllAllianceValidatorInfo(ctx sdk.Context) []types.AllianceVal
}
return infos
}

func (k Keeper) DeleteValidatorInfo(ctx sdk.Context, valAddr sdk.ValAddress) {
store := ctx.KVStore(k.storeKey)
key := types.GetAllianceValidatorInfoKey(valAddr)
store.Delete(key)
}
1 change: 0 additions & 1 deletion x/alliance/tests/benchmark/benchmark_genesis.json

This file was deleted.

0 comments on commit 1cdf4e3

Please sign in to comment.