Skip to content

Commit

Permalink
Get latest snapshot if no id is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
Vizualni committed Jul 26, 2022
1 parent 2f653d8 commit 0dffcab
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion x/valset/keeper/grpc_query_get_snapshot_by_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,15 @@ func (k Keeper) GetSnapshotByID(goCtx context.Context, req *types.QueryGetSnapsh
}

ctx := sdk.UnwrapSDKContext(goCtx)
var snapshot *types.Snapshot
var err error

if req.SnapshotId == 0 {
snapshot, err = k.GetCurrentSnapshot(ctx)
} else {
snapshot, err = k.FindSnapshotByID(ctx, req.SnapshotId)
}

snapshot, err := k.FindSnapshotByID(ctx, req.SnapshotId)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 0dffcab

Please sign in to comment.