Point of leader election is that (1) only one leader election; and (2) everyone knows who the leader is
Setup
ballot_ids , highest ballot_id is electedid along the ring
max(rcv_id, my_id)id sees itself, it knows that its id went around the whole ring, so it sends it again to tell everyone that it is the leaderid as its leaderWorst-case: Initiator is one after the highest id → 3(N-1) messages and completion time
Best-case: Initiator is the highest id → 2N messages and completion time

⚠️ Problem: if elected leader dies but their elected message lives on, we are in trouble!!
✅ no real solution other than using a failure detector and hoping it catches the failure and initiates a new election
Similar to ring but smarter with re-election upon old leader dying
# once leader dies
p = process that detected the failure
if p.id == max(ids_in_my_membership_list)
**elect self as leader and tell everyone**
everyone elects p
else
initiate new election -> send ONLY to processes with ids > p.id # avoid wasted effort to send to all peers
if no messages within timeout:
**elect self as leader and tell everyone**
else if answer from higher id rcved:
wait for election message from that higher id processs
Is this safe?

Worst-case: lowest id detects failure → N^2 messages