mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-16 19:32:55 +00:00
Rename JustificationManager
This commit is contained in:
@@ -211,22 +211,7 @@ impl ProtoArray {
|
||||
/// - The finalized epoch is less than the current one.
|
||||
/// - The finalized epoch is equal to the current one, but the finalized root is different.
|
||||
/// - There is some internal error relating to invalid indices inside `self`.
|
||||
pub fn maybe_prune(
|
||||
&mut self,
|
||||
finalized_epoch: Epoch,
|
||||
finalized_root: Hash256,
|
||||
) -> Result<(), Error> {
|
||||
if finalized_epoch < self.finalized_epoch {
|
||||
// It's illegal to swap to an earlier finalized root (this is assumed to be reverting a
|
||||
// finalized block).
|
||||
return Err(Error::RevertedFinalizedEpoch {
|
||||
current_finalized_epoch: self.finalized_epoch,
|
||||
new_finalized_epoch: finalized_epoch,
|
||||
});
|
||||
} else if finalized_epoch != self.finalized_epoch {
|
||||
self.finalized_epoch = finalized_epoch;
|
||||
}
|
||||
|
||||
pub fn maybe_prune(&mut self, finalized_root: Hash256) -> Result<(), Error> {
|
||||
let finalized_index = *self
|
||||
.indices
|
||||
.get(&finalized_root)
|
||||
|
||||
@@ -34,11 +34,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get(&mut self, i: usize) -> &T {
|
||||
self.ensure(i);
|
||||
&self.0[i]
|
||||
}
|
||||
|
||||
pub fn get_mut(&mut self, i: usize) -> &mut T {
|
||||
self.ensure(i);
|
||||
&mut self.0[i]
|
||||
@@ -164,14 +159,10 @@ impl ProtoArrayForkChoice {
|
||||
.map_err(|e| format!("find_head failed: {:?}", e))
|
||||
}
|
||||
|
||||
pub fn update_finalized_root(
|
||||
&self,
|
||||
finalized_epoch: Epoch,
|
||||
finalized_root: Hash256,
|
||||
) -> Result<(), String> {
|
||||
pub fn maybe_prune(&self, finalized_root: Hash256) -> Result<(), String> {
|
||||
self.proto_array
|
||||
.write()
|
||||
.maybe_prune(finalized_epoch, finalized_root)
|
||||
.maybe_prune(finalized_root)
|
||||
.map_err(|e| format!("find_head maybe_prune failed: {:?}", e))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user