[R4R] fix: don't panic on expired auctions in init genesis (#668)

* fix: close expired auctions in init genesis

* fix: initialize variable

* remove expired auction invarient
This commit is contained in:
Kevin Davis 2020-10-02 12:50:56 -04:00 committed by GitHub
parent 8f69dcf960
commit d15e3a43dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,6 @@ package keeper
import (
"fmt"
"time"
"github.com/cosmos/cosmos-sdk/store/prefix"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -61,15 +60,6 @@ func ValidAuctionInvariant(k Keeper) sdk.Invariant {
panic("stored auction type does not fulfill GenesisAuction interface")
}
currentTime := ctx.BlockTime()
if !currentTime.Equal(time.Time{}) { // this avoids a simulator bug where app.InitGenesis is called with blockTime=0 instead of the correct time
if a.GetEndTime().Before(currentTime) {
validationErr = fmt.Errorf("endTime before current block time (%s)", currentTime)
invalidAuction = a
return true
}
}
if err := a.Validate(); err != nil {
validationErr = err
invalidAuction = a