Skip to content

Commit 61e2c14

Browse files
authored
fix: reject delegation renew changes for exited validations (#1178)
1 parent 042b636 commit 61e2c14

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

builtin/staker/delegations.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ func (d *delegations) DisableAutoRenew(delegationID thor.Bytes32) error {
115115
if delegation.Stake.Sign() == 0 {
116116
return errors.New("delegation is not active")
117117
}
118+
if validation.Status == StatusExit {
119+
return errors.New("delegation is not active, withdraw is available")
120+
}
118121

119122
weight := delegation.Weight()
120123

@@ -158,6 +161,9 @@ func (d *delegations) EnableAutoRenew(delegationID thor.Bytes32) error {
158161
if delegation.AutoRenew {
159162
return errors.New("delegation is already autoRenew")
160163
}
164+
if validation.Status == StatusExit {
165+
return errors.New("delegation is not active, withdraw is available")
166+
}
161167
weight := delegation.Weight()
162168

163169
// validate that the enablement does not exceed the max stake considering next staking period changes

0 commit comments

Comments
 (0)