The Messenger of Allah ﷺ used to pray Maghrib when the sun had set and disappeared behind the veil of the horizon.
حدثنا قتيبة حدثنا حاتم بن إسمعيل عن يزيد بن أبي عبيد
كان رسول الله ﷺ يصلي المغرب إذا غربت الشمس وتوارت بالحجاب
Agreed upon [by Bukhari and Muslim]. Muslim narrated it in the Book of Mosques, chapter on the statement that the first time for Maghrib is at sunset, hadith no. 636, from Qutayba, and Bukhari in the Book of Prayer Times, chapter on the time of Maghrib, hadith no. 561, from the report of Yazid bin Abu Ubayd, with the same wording.There are also reports on this topic from Jabir [Ahmad 3/303, 331, 382, and Ibn Khuzayma, hadith no. 337], from Sunabihi [Ahmad 4/349], from Zayd bin Khalid [Ahmad 4/114, 115, 117], from Anas [Abu Dawud, hadith no. 416], from Rafi bin Khadij [Bukhari, hadith no. 559, and Muslim, hadith no. 637], from Abu Ayub [Ahmad 5/415, 421, and Abu Dawud, hadith no. 418], from Umm Habiba [we did not find it], from Abbas bin Abdul-Muttalib [Ibn Majah, hadith no. 689, and Ibn Khuzayma, hadith no. 340], and from Ibn Abbas [we did not find it].