Skip to content

Commit

Permalink
Revisit grid routes export
Browse files Browse the repository at this point in the history
  • Loading branch information
cyborgshead committed Sep 11, 2024
1 parent bb08c66 commit 19eb968
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
13 changes: 13 additions & 0 deletions x/grid/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ func InitGenesis(ctx sdk.Context, k Keeper, data types.GenesisState) {
}
}

// TODO fix empty case
//"grid" : {
// "routes" : [{
// "destination" : "",
// "value" : [],
// "source" : "",
// "name" : ""
// }],
// "params" : {
// "max_routes" : 16
// }
//}

func ExportGenesis(ctx sdk.Context, k Keeper) *types.GenesisState {
params := k.GetParams(ctx)
routes := k.GetAllRoutes(ctx)
Expand Down
7 changes: 5 additions & 2 deletions x/grid/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package keeper

import (
"fmt"

storetypes "github.com/cosmos/cosmos-sdk/store/types"

"github.com/cometbft/cometbft/libs/log"
Expand Down Expand Up @@ -270,7 +269,11 @@ func (k Keeper) IterateAllRoutes(ctx sdk.Context, cb func(route types.Route) (st
defer iterator.Close()

for ; iterator.Valid(); iterator.Next() {
route := types.MustUnmarshalRoute(k.cdc, iterator.Value())
route, err := types.UnmarshalRoute(k.cdc, iterator.Value())
if err != nil {
// TODO revisit this error handling
continue
}
if cb(route) {
break
}
Expand Down

0 comments on commit 19eb968

Please sign in to comment.