Description
The bookAppointment and bookAppointmentEmergency functions in DoctorSide.sol do not verify whether a slot has already been booked before creating a new appointment.
As a result, multiple patients can reserve the same appointment slot for the same doctor, leading to double-booking, scheduling conflicts, and inconsistent appointment records.
Location
MedETH/foundry/src/DoctorSide.sol — bookAppointment
Current Code
// no check on slot availability before booking
docIdtoAppointmentId[doctorId].push(totalAppointments);
patIdtoAppointmentId[patId].push(totalAppointments);
Impact
- Multiple patients can book the same slot simultaneously
- Doctors may receive conflicting appointments
- Appointment data becomes inconsistent and unreliable
- Emergency and regular booking flows are both affected
Expected Behavior
The contract should verify that the selected slot is still available before confirming the appointment.
If the slot is already booked, the transaction should revert.
Severity
Medium causes appointment conflicts, inconsistent scheduling data, and unreliable booking behavior.
Description
The
bookAppointmentandbookAppointmentEmergencyfunctions inDoctorSide.soldo not verify whether a slot has already been booked before creating a new appointment.As a result, multiple patients can reserve the same appointment slot for the same doctor, leading to double-booking, scheduling conflicts, and inconsistent appointment records.
Location
MedETH/foundry/src/DoctorSide.sol—bookAppointmentCurrent Code
Impact
Expected Behavior
The contract should verify that the selected slot is still available before confirming the appointment.
If the slot is already booked, the transaction should revert.
Severity
Medium causes appointment conflicts, inconsistent scheduling data, and unreliable booking behavior.