Merge PR #3522: get rid of double negatives: IsNotNegative -> IsAnyNegative
This commit is contained in:
committed by
Jack Zampolin
parent
17c84ab34a
commit
b63b6254c8
+1
-1
@@ -46,7 +46,7 @@ func (tx StdTx) ValidateBasic() sdk.Error {
|
||||
if tx.Fee.Gas > maxGasWanted {
|
||||
return sdk.ErrGasOverflow(fmt.Sprintf("invalid gas supplied; %d > %d", tx.Fee.Gas, maxGasWanted))
|
||||
}
|
||||
if !tx.Fee.Amount.IsNotNegative() {
|
||||
if tx.Fee.Amount.IsAnyNegative() {
|
||||
return sdk.ErrInsufficientFee(fmt.Sprintf("invalid fee %s amount provided", tx.Fee.Amount))
|
||||
}
|
||||
if len(stdSigs) == 0 {
|
||||
|
||||
+1
-1
@@ -258,7 +258,7 @@ func addCoins(ctx sdk.Context, am auth.AccountKeeper, addr sdk.AccAddress, amt s
|
||||
oldCoins := getCoins(ctx, am, addr)
|
||||
newCoins := oldCoins.Plus(amt)
|
||||
|
||||
if !newCoins.IsNotNegative() {
|
||||
if newCoins.IsAnyNegative() {
|
||||
return amt, nil, sdk.ErrInsufficientCoins(fmt.Sprintf("%s < %s", oldCoins, amt))
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ func NonnegativeBalanceInvariant(mapper auth.AccountKeeper) simulation.Invariant
|
||||
accts := mock.GetAllAccounts(mapper, ctx)
|
||||
for _, acc := range accts {
|
||||
coins := acc.GetCoins()
|
||||
if !coins.IsNotNegative() {
|
||||
if coins.IsAnyNegative() {
|
||||
return fmt.Errorf("%s has a negative denomination of %s",
|
||||
acc.GetAddress().String(),
|
||||
coins.String())
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ func (msg MsgSubmitProposal) ValidateBasic() sdk.Error {
|
||||
if !msg.InitialDeposit.IsValid() {
|
||||
return sdk.ErrInvalidCoins(msg.InitialDeposit.String())
|
||||
}
|
||||
if !msg.InitialDeposit.IsNotNegative() {
|
||||
if msg.InitialDeposit.IsAnyNegative() {
|
||||
return sdk.ErrInvalidCoins(msg.InitialDeposit.String())
|
||||
}
|
||||
return nil
|
||||
@@ -120,7 +120,7 @@ func (msg MsgDeposit) ValidateBasic() sdk.Error {
|
||||
if !msg.Amount.IsValid() {
|
||||
return sdk.ErrInvalidCoins(msg.Amount.String())
|
||||
}
|
||||
if !msg.Amount.IsNotNegative() {
|
||||
if msg.Amount.IsAnyNegative() {
|
||||
return sdk.ErrInvalidCoins(msg.Amount.String())
|
||||
}
|
||||
if msg.ProposalID < 0 {
|
||||
|
||||
Reference in New Issue
Block a user