Skip to content

Commit

Permalink
increment validator bond shares in cancel unbonding
Browse files Browse the repository at this point in the history
  • Loading branch information
sampocs committed Aug 14, 2023
1 parent 846943c commit c571075
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion x/staking/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,11 +610,20 @@ func (k msgServer) CancelUnbondingDelegation(goCtx context.Context, msg *types.M
}

// delegate back the unbonding delegation amount to the validator
_, err = k.Keeper.Delegate(ctx, delegatorAddress, msg.Amount.Amount, types.Unbonding, validator, false)
newShares, err := k.Keeper.Delegate(ctx, delegatorAddress, msg.Amount.Amount, types.Unbonding, validator, false)
if err != nil {
return nil, err
}

// If the delegation is a validator bond, increment the validator bond shares
delegation, found := k.Keeper.GetDelegation(ctx, delegatorAddress, valAddr)
if !found {
return nil, types.ErrNoDelegation
}
if delegation.ValidatorBond {
k.IncreaseValidatorBondShares(ctx, validator, newShares)
}

amount := unbondEntry.Balance.Sub(msg.Amount.Amount)
if amount.IsZero() {
ubd.RemoveEntry(unbondEntryIndex)
Expand Down

0 comments on commit c571075

Please sign in to comment.