Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mconcat committed May 2, 2022
1 parent 0ebe1ef commit dba0383
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion x/lockup/keeper/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ func (k Keeper) ExtendLockup(ctx sdk.Context, lock types.PeriodLock, newDuration
oldLock := lock

if newDuration != 0 {
if newDuration < lock.Duration {
if newDuration <= lock.Duration {
return fmt.Errorf("new duration should be greater than the original")
}

Expand Down
6 changes: 3 additions & 3 deletions x/lockup/keeper/lock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,17 +671,17 @@ func (suite *KeeperTestSuite) TestEditLockup() {
// extending lock with same duration should fail
err = suite.App.LockupKeeper.ExtendLockup(suite.Ctx, *lock, time.Second)
suite.Require().Error(err)

// duration increase should success
err = suite.App.LockupKeeper.ExtendLockup(suite.Ctx, *lock, time.Second*2)
suite.Require().NoError(err)

// check queries
lock, _ = suite.App.LockupKeeper.GetLockByID(suite.Ctx, lock.ID)
suite.Require().Equal(lock.Duration, time.Second*2)
suite.Require().Equal(1, lock.ID)
suite.Require().Equal(uint64(1), lock.ID)
suite.Require().Equal(coins, lock.Coins)

locks = suite.App.LockupKeeper.GetLocksLongerThanDurationDenom(suite.Ctx, "stake", time.Second)
suite.Require().Equal(len(locks), 1)

Expand Down

0 comments on commit dba0383

Please sign in to comment.