mirror of
https://github.com/0glabs/0g-chain.git
synced 2025-01-13 00:35:17 +00:00
fix panic(err) if posted_prices=[] in genesis file (#352)
This commit is contained in:
parent
55f0f8d980
commit
3c8209cbcc
@ -25,6 +25,8 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, gs GenesisState) {
|
|||||||
// Set the current price (if any) based on what's now in the store
|
// Set the current price (if any) based on what's now in the store
|
||||||
for _, market := range params.Markets {
|
for _, market := range params.Markets {
|
||||||
if market.Active {
|
if market.Active {
|
||||||
|
rps := keeper.GetRawPrices(ctx, market.MarketID)
|
||||||
|
if len(rps) > 0 {
|
||||||
err := keeper.SetCurrentPrices(ctx, market.MarketID)
|
err := keeper.SetCurrentPrices(ctx, market.MarketID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@ -32,6 +34,7 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, gs GenesisState) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ExportGenesis returns a GenesisState for a given context and keeper.
|
// ExportGenesis returns a GenesisState for a given context and keeper.
|
||||||
func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState {
|
func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState {
|
||||||
|
Loading…
Reference in New Issue
Block a user