    :voted-for nil  ; persist
    :log [{:term 0 :cmd :init}]         ; persist start at 1
    :id id          ; user assigned
+   :tx-queue []
+   :rx-queue []
    :commit-index 0
    :last-applied 0
    :type :follower

                          :leader-commit (:commit-index state)})))

(defn- send-request-vote [state peer]
  (request-vote peer {:term (:current-term state)
                      :candidate-id (:id state)
                      :last-log-index (:commit-index state)
                      :last-log-term (get-log-term state)}))


(defn- broadcast-heartbeat [state]
  (doseq [r (map (partial send-heart-beat state) (:peers state))])

  state)

(defn broadcast-request-vote [state]
  (assoc state :tx-queue (vec (concat (:tx-queue state) (map (partial send-request-vote state) (:peers state))))))
  ;; (let [r (map (partial send-request-vote state) (:peers state))]
  ;;   (if (> (->> (map :vote-granted? r) (filter identity) (count))
  ;;          (/ (count (:peers state)) 2))
  ;;     (become-leader state (map :term r))
  ;;     state)))

(defn check-election-timeout [state]
  (if (election-timeout? state)
