Merge PR #2514: Refactor validator deletion
This commit is contained in:
committed by
Christopher Goes
parent
a7e6969029
commit
505c356f20
@@ -3,15 +3,19 @@
|
||||
## Unbonding Validator Queue
|
||||
|
||||
For all unbonding validators that have finished their unbonding period, this switches their validator.Status
|
||||
from sdk.Unbonding to sdk.Unbonded
|
||||
from sdk.Unbonding to sdk.Unbonded if they still have any delegation left. Otherwise, it deletes it from state.
|
||||
|
||||
```golang
|
||||
validatorQueue(currTime time.Time):
|
||||
// unbonding validators are in ordered queue from oldest to newest
|
||||
for all unbondingValidators whose CompleteTime < currTime:
|
||||
validator = GetValidator(unbondingValidator.ValidatorAddr)
|
||||
validator.Status = sdk.Bonded
|
||||
SetValidator(unbondingValidator)
|
||||
if validator.DelegatorShares == 0 {
|
||||
RemoveValidator(unbondingValidator)
|
||||
} else {
|
||||
validator.Status = sdk.Unbonded
|
||||
SetValidator(unbondingValidator)
|
||||
}
|
||||
return
|
||||
```
|
||||
|
||||
@@ -61,4 +65,4 @@ redelegationQueue(currTime time.Time):
|
||||
for all redelegations whose CompleteTime < currTime:
|
||||
removeRedelegation(redelegation)
|
||||
return
|
||||
```
|
||||
```
|
||||
|
||||
@@ -180,7 +180,7 @@ startUnbonding(tx TxStartUnbonding):
|
||||
|
||||
validator = updateValidator(validator)
|
||||
|
||||
if validator.DelegatorShares == 0 {
|
||||
if validator.Status == Unbonded && validator.DelegatorShares == 0 {
|
||||
removeValidator(validator.Operator)
|
||||
|
||||
return
|
||||
@@ -189,8 +189,7 @@ startUnbonding(tx TxStartUnbonding):
|
||||
### TxRedelegation
|
||||
|
||||
The redelegation command allows delegators to instantly switch validators. Once
|
||||
the unbonding period has passed, the redelegation must be completed with
|
||||
txRedelegationComplete.
|
||||
the unbonding period has passed, the redelegation is automatically completed in the EndBlocker.
|
||||
|
||||
```golang
|
||||
type TxRedelegate struct {
|
||||
|
||||
Reference in New Issue
Block a user