This commit is contained in:
Paul Hauner
2020-01-17 13:01:06 +11:00
parent b55687cf9d
commit cd5c8a3d9f
2 changed files with 7 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
mod checkpoint_manager;
use crate::{errors::BeaconChainError, metrics, BeaconChain, BeaconChainTypes};
use checkpoint_manager::{CheckpointBalances, CheckpointManager};
use checkpoint_manager::{CheckpointManager, CheckpointWithBalances};
use parking_lot::RwLock;
use proto_array_fork_choice::ProtoArrayForkChoice;
use ssz_derive::{Decode, Encode};
@@ -59,7 +59,7 @@ impl<T: BeaconChainTypes> ForkChoice<T> {
genesis_block_root: Hash256,
genesis_state: &BeaconState<T::EthSpec>,
) -> Self {
let genesis_checkpoint = CheckpointBalances {
let genesis_checkpoint = CheckpointWithBalances {
epoch: genesis_state.current_epoch(),
root: genesis_block_root,
balances: genesis_state.balances.clone().into(),

View File

@@ -5,13 +5,13 @@ use ssz_derive::{Decode, Encode};
use types::{BeaconState, Checkpoint, Epoch, EthSpec, Hash256, Slot};
#[derive(PartialEq, Clone, Encode, Decode)]
pub struct CheckpointBalances {
pub struct CheckpointWithBalances {
pub epoch: Epoch,
pub root: Hash256,
pub balances: Vec<u64>,
}
impl Into<Checkpoint> for CheckpointBalances {
impl Into<Checkpoint> for CheckpointWithBalances {
fn into(self) -> Checkpoint {
Checkpoint {
epoch: self.epoch,
@@ -22,7 +22,7 @@ impl Into<Checkpoint> for CheckpointBalances {
#[derive(PartialEq, Clone, Encode, Decode)]
pub struct FFGCheckpoints {
pub justified: CheckpointBalances,
pub justified: CheckpointWithBalances,
pub finalized: Checkpoint,
}
@@ -34,7 +34,7 @@ pub struct CheckpointManager {
}
impl CheckpointManager {
pub fn new(genesis_checkpoint: CheckpointBalances) -> Self {
pub fn new(genesis_checkpoint: CheckpointWithBalances) -> Self {
let ffg_checkpoint = FFGCheckpoints {
justified: genesis_checkpoint.clone(),
finalized: genesis_checkpoint.into(),
@@ -87,7 +87,7 @@ impl CheckpointManager {
&& state.finalized_checkpoint.epoch >= self.current.finalized.epoch
{
let candidate = FFGCheckpoints {
justified: CheckpointBalances {
justified: CheckpointWithBalances {
epoch: state.current_justified_checkpoint.epoch,
root: state.current_justified_checkpoint.root,
balances: state.balances.clone().into(),