mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 09:16:00 +00:00
Attempt to fix prune error
This commit is contained in:
@@ -357,19 +357,23 @@ impl<T: BeaconChainTypes> ForkChoice<T> {
|
|||||||
finalized_block: &BeaconBlock<T::EthSpec>,
|
finalized_block: &BeaconBlock<T::EthSpec>,
|
||||||
finalized_block_root: Hash256,
|
finalized_block_root: Hash256,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
// Only prune if it won't remove our current justified epoch.
|
let epoch = finalized_block.slot.epoch(T::EthSpec::slots_per_epoch());
|
||||||
if self.justification_manager.read().justified_checkpoint.epoch
|
|
||||||
>= finalized_block.slot.epoch(T::EthSpec::slots_per_epoch())
|
// TODO: be more stringent about changing the finalized checkpoint (i.e., check for
|
||||||
{
|
// reversion and stuff).
|
||||||
|
if epoch > self.finalized_checkpoint.read().epoch {
|
||||||
|
*self.finalized_checkpoint.write() = Checkpoint {
|
||||||
|
epoch,
|
||||||
|
root: finalized_block_root,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
self.backend
|
self.backend
|
||||||
.update_finalized_root(
|
.update_finalized_root(
|
||||||
finalized_block.slot.epoch(T::EthSpec::slots_per_epoch()),
|
self.finalized_checkpoint.read().epoch,
|
||||||
finalized_block_root,
|
self.finalized_checkpoint.read().root,
|
||||||
)
|
)
|
||||||
.map_err(Into::into)
|
.map_err(Into::into)
|
||||||
} else {
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a `SszForkChoice` which contains the current state of `Self`.
|
/// Returns a `SszForkChoice` which contains the current state of `Self`.
|
||||||
|
|||||||
Reference in New Issue
Block a user