mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 08:15:19 +00:00
[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:
parent
8f69dcf960
commit
d15e3a43dd
@ -2,7 +2,6 @@ package keeper
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
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")
|
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 {
|
if err := a.Validate(); err != nil {
|
||||||
validationErr = err
|
validationErr = err
|
||||||
invalidAuction = a
|
invalidAuction = a
|
||||||
|
Loading…
Reference in New Issue
Block a user