diff --git a/beacon_node/beacon_chain/src/beacon_chain.rs b/beacon_node/beacon_chain/src/beacon_chain.rs index ca089789d5..eb79da1f53 100644 --- a/beacon_node/beacon_chain/src/beacon_chain.rs +++ b/beacon_node/beacon_chain/src/beacon_chain.rs @@ -347,6 +347,9 @@ impl BeaconChain { /// state and calling `catchup_state` as it will not result in an old state being installed and /// then having it iteratively updated -- in such a case it's possible for another thread to /// find the state at an old slot. + /// + /// Also persists the `BeaconChain` to the store, in the case the client does not exit + /// gracefully. pub fn update_state(&self, mut state: BeaconState) -> Result<(), Error> { let present_slot = match self.slot_clock.present_slot() { Ok(Some(slot)) => slot, @@ -362,6 +365,8 @@ impl BeaconChain { *self.state.write() = state; + self.persist()?; + Ok(()) }