Adversity should not be viewed as either disfavor from the Lord or a withdrawal of His blessings. Opposition in all things is part of the refiner’s fire to prepare us for an eternal celestial destiny.
Elder Quentin L. Cook, "Foundations of Faith", General Conference, April 2017
I think, sometimes, that my challenges are because of something I've done, a punishment of sorts. But then my spiritual side assures me that that way of thinking is completely incorrect. God does not punish.
Instead, I am confronted with challenges because of the love God has for me. He is molding me. He is shaping me. He is refining me.
The writer, Malcolm Gladwell, proposed a theory called the 10,000 hour rule. It basically means that to become an expert in one thing, it'll take 10,000 hours of study and practice in that one thing.
Now, it doesn't exactly take 10,000 hours of practice for our faith to be ever so strong, like the faith of the brother of Jared, but the significance is the same...we need to spend hours and hours and hours learning, studying, pondering, and living the words of God. It'll take a lifetime of practice and even beyond this life.... especially beyond this life.
I would argue, too, that the opposite is true as well....the more we don't learn and live the words of God, the further the other direction we'll find ourselves....angels to the devil. Those hours add up too.
Point is, Heavenly Father is not punishing us with the things we go through... He is shaping us. He is turning us into the people He knows we can become. Our job is to spend our time on the things that eternally matter.