Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jieyilong committed Feb 25, 2022
1 parent 29a6916 commit 2c2bf9e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ledger/execution/tx_deposit_stake.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,15 @@ func (exec *DepositStakeExecutor) sanityCheck(chainID string, view *st.StoreView
}

// Minimum stake deposit requirement to avoid spamming
if tx.Purpose == core.StakeForValidator && stake.ThetaWei.Cmp(core.MinValidatorStakeDeposit) < 0 {
return result.Error("Insufficient amount of stake, at least %v ThetaWei is required for each validator deposit", core.MinValidatorStakeDeposit).
WithErrorCode(result.CodeInsufficientStake)
if tx.Purpose == core.StakeForValidator {
minValidatorStake := core.MinValidatorStakeDeposit
if blockHeight >= common.HeightValidatorStakeChangedTo200K {
minValidatorStake = core.MinValidatorStakeDeposit200K
}
if stake.ThetaWei.Cmp(minValidatorStake) < 0 {
return result.Error("Insufficient amount of stake, at least %v ThetaWei is required for each validator deposit", minValidatorStake).
WithErrorCode(result.CodeInsufficientStake)
}
}

if tx.Purpose == core.StakeForGuardian {
Expand Down

0 comments on commit 2c2bf9e

Please sign in to comment.