Files
lighthouse/eth2/state_processing/src/per_block_processing/verify_deposit.rs
2019-03-07 14:29:21 +11:00

28 lines
710 B
Rust

use super::errors::{DepositInvalid as Invalid, DepositValidationError as Error};
use types::*;
/// Indicates if a `Deposit` is valid to be included in a block in the current epoch of the given
/// state.
///
/// Returns `Ok(())` if the `Deposit` is valid, otherwise indicates the reason for invalidity.
///
/// Note: this function is incomplete.
///
/// Spec v0.4.0
pub fn verify_deposit(
state: &BeaconState,
deposit: &Deposit,
_spec: &ChainSpec,
) -> Result<(), Error> {
// TODO: verify serialized deposit data.
verify!(
deposit.index == state.deposit_index,
Invalid::BadIndex(state.deposit_index, deposit.index)
);
// TODO: verify merkle branch.
Ok(())
}