mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-18 04:13:00 +00:00
* Update to spec v0.9.0 * Update to v0.9.1 * Bump spec tags for v0.9.1 * Formatting, fix CI failures * Resolve accidental KeyPair merge conflict * Document new BeaconState functions * Fix incorrect cache drops in `advance_caches` * Update fork choice for v0.9.1 * Clean up some FIXMEs * Fix a few docs/logs
25 lines
816 B
Rust
25 lines
816 B
Rust
use super::get_attesting_indices;
|
|
use crate::per_block_processing::errors::{AttestationInvalid as Invalid, BlockOperationError};
|
|
use types::*;
|
|
|
|
type Result<T> = std::result::Result<T, BlockOperationError<Invalid>>;
|
|
|
|
/// Convert `attestation` to (almost) indexed-verifiable form.
|
|
///
|
|
/// Spec v0.9.1
|
|
pub fn get_indexed_attestation<T: EthSpec>(
|
|
state: &BeaconState<T>,
|
|
attestation: &Attestation<T>,
|
|
) -> Result<IndexedAttestation<T>> {
|
|
let attesting_indices =
|
|
get_attesting_indices(state, &attestation.data, &attestation.aggregation_bits)?;
|
|
|
|
Ok(IndexedAttestation {
|
|
attesting_indices: VariableList::new(
|
|
attesting_indices.into_iter().map(|x| x as u64).collect(),
|
|
)?,
|
|
data: attestation.data.clone(),
|
|
signature: attestation.signature.clone(),
|
|
})
|
|
}
|