Hmm, I thought the state of the node (i.e. whether it's LeaderState, FollowerState etc.) is volatile? It's the log and commit index that are persistent and (even though it's not clear from this code) this should have been the case. In my second iteration, I'll split the states to something like AliveNode and DeadNode so that it's clearer what's what.

Unless I'm mistaken.