Skip to content

bug: appointment booking allows double-booking of occupied slots #73

Description

@ayuxsh009

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.solbookAppointment

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions