As useless as it feels, how you handled it, diving in with full focus to the point that you stayed up all night- you're working a muscle many engineers don't and you'll be better for it.
It’s the muscle of being able to quickly orient yourself in sudden problems and drive towards useful solutions in a focused manner.
And to be fair, if the product line hadn’t been thrown out before I started, the project would have been useful in either A) fixing the product or B) providing justification to scrap the product line (probably the more likely outcome)
And I developed a nice tool that got used somewhere else later useful.