Skip to content

Commit

Permalink
check iterate error
Browse files Browse the repository at this point in the history
  • Loading branch information
nullpointer0x00 committed Oct 18, 2023
1 parent 94f8040 commit d70a3ab
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,14 @@ func addMarkerNavs(ctx sdk.Context, app *App) {

app.MarkerKeeper.IterateMarkers(ctx, func(record markertypes.MarkerAccountI) bool {
var hasNav bool
app.MarkerKeeper.IterateNetAssetValues(ctx, record.GetAddress(), func(nav markertypes.NetAssetValue) bool {
err := app.MarkerKeeper.IterateNetAssetValues(ctx, record.GetAddress(), func(nav markertypes.NetAssetValue) bool {
hasNav = true
return true
})
if err != nil {
ctx.Logger().Error(fmt.Sprintf("unable iterate net asset values for marker %v: %v", record, err))
return false
}

Check warning on line 362 in app/upgrades.go

View check run for this annotation

Codecov / codecov/patch

app/upgrades.go#L360-L362

Added lines #L360 - L362 were not covered by tests
if !hasNav {
nav := markertypes.NewNetAssetValue(sdk.NewInt64Coin(markertypes.UsdDenom, int64(150)), 1)
if err := app.MarkerKeeper.AddSetNetAssetValues(ctx, record, []markertypes.NetAssetValue{nav}, "upgrade_handler"); err != nil {
Expand Down

0 comments on commit d70a3ab

Please sign in to comment.