Well, it's both (if it's not shocking)!
These two sentences make use of two types of past tenses.
One - past perfect tense.
Another - past continuous tense.
Whatever. But, both the sentences convey the same meaning, with a slight difference. Anyways, both sentences are grammatically correct. The sentence-structure and all.
There isn't any option like this one is correct and the other is not.
It's just that both the sentences in past tense convey a slightly different meaning.
Each are two different CORRECT sentences which convey a differnt meaning.
I hope I was able to get to the point.
Now, I will provide the explanation. What do the two sentences each mean?
PAST TENSE - It means something happenned in the past. By 'something', I refer to any event, action, or stuff like this. 'Something' has been completed in the past. It has completed taking place, already.
So, the first sentence