           ;; Continue offering barriers until success
           (offer-barriers state) 
 
-          (and sealing? (not (checkpointing? state status)))
+          (and sealing? (not (checkpointing? (:checkpoint state) status)))
           (complete-job state)
 
           (or completed? sealing?

                       :epoch checkpointed-epoch}
          ;; get the next version of the zk node, so we can detect when there are other writers
          write-version (:write-version checkpoint)
          _ (assert write-version)
          next-write-version (if write-coordinate?
                               (write-coordinate write-version log tenancy-id job-id coordinates)
                               write-version)
          checkpoint? (first (shuffle [true #_false]))
          messenger (m/set-epoch! messenger (inc (m/epoch messenger)))]
      (-> state
          (update :checkpoint merge {:epoch (if checkpoint? (m/epoch messenger) (:epoch checkpoint))
                                     :write-version next-write-version})
          (update :barrier merge {:scheduled false
                                  :offering? true
                                  :remaining (m/publishers messenger)
                                  :opts {:completed? (:sealing? (:job state))
                                         :checkpoint? checkpoint?}})
          (assoc :checkpointing? checkpoint?
                 :messenger messenger)))))

(defn shutdown [{:keys [peer-config log workflow-depth job-id messenger] :as state}]
  (assoc state :messenger (component/stop messenger)))

                                        :remaining (m/publishers new-messenger)
                                        :opts {:recover-coordinates coordinates}})
                (update :checkpoint merge {:epoch 0})
                (assoc :messenger new-messenger)
                (assoc :curr-replica new-replica)))

          :else
          (assoc state :curr-replica new-replica))))
