Implement saving BeaconChain on client drop

This commit is contained in:
Paul Hauner
2019-05-27 16:32:46 +10:00
parent 9ed8a4d380
commit faa682a9b5
3 changed files with 34 additions and 9 deletions

View File

@@ -336,6 +336,11 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
self.canonical_head.read()
}
/// Returns the slot of the highest block in the canonical chain.
pub fn best_slot(&self) -> Slot {
self.canonical_head.read().beacon_block.slot
}
/// Updates the canonical `BeaconState` with the supplied state.
///
/// Advances the chain forward to the present slot. This method is better than just setting