Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) narrates: When wine was made unlawful, the people said: "O Messenger of Allah! What about our companions who died while they used to drink it!" So Allah, the Mighty and Majestic, revealed this verse: "There is no sin upon those who believe and do righteous deeds for what they have (previously) eaten and drunk."
Imam Ahmad (may Allah have mercy on him) narrated this hadith through Khalaf bin al-Walid from Isra'il.
And Imam al-Tirmidhi (may Allah have mercy on him) narrated it from Abd bin Humayd, he from Abd al-Aziz bin Abi Rizmah, he from Isra'il, and said: "This hadith is hasan."
And Abu Hatim al-Busti (may Allah have mercy on him) narrated it from Abu Ya'la al-Mawsili (may Allah have mercy on him).
Related hadith on this topic