fix compile after merge

This commit is contained in:
realbigsean
2023-04-27 14:30:07 -04:00
parent eadf293419
commit 185b7615a2

View File

@@ -15,12 +15,13 @@ use crate::BeaconChainError;
use eth2::types::BlockContentsTuple; use eth2::types::BlockContentsTuple;
use kzg::Kzg; use kzg::Kzg;
use slog::{debug, warn}; use slog::{debug, warn};
use ssz_types::FixedVector;
use std::borrow::Cow; use std::borrow::Cow;
use types::blob_sidecar::{BlobIdentifier, FixedBlobSidecarList}; use types::blob_sidecar::{BlobIdentifier, FixedBlobSidecarList};
use types::{ use types::{
BeaconBlockRef, BeaconState, BeaconStateError, BlobSidecar, BlobSidecarList, ChainSpec, BeaconBlockRef, BeaconState, BeaconStateError, BlobSidecar, ChainSpec, CloneConfig, Epoch,
CloneConfig, Epoch, EthSpec, FullPayload, Hash256, KzgCommitment, RelativeEpoch, EthSpec, FullPayload, Hash256, KzgCommitment, RelativeEpoch, SignedBeaconBlock,
SignedBeaconBlock, SignedBeaconBlockHeader, SignedBlobSidecar, Slot, SignedBeaconBlockHeader, SignedBlobSidecar, Slot,
}; };
#[derive(Debug)] #[derive(Debug)]
@@ -683,13 +684,15 @@ impl<E: EthSpec> From<SignedBeaconBlock<E>> for BlockWrapper<E> {
impl<E: EthSpec> From<BlockContentsTuple<E, FullPayload<E>>> for BlockWrapper<E> { impl<E: EthSpec> From<BlockContentsTuple<E, FullPayload<E>>> for BlockWrapper<E> {
fn from(value: BlockContentsTuple<E, FullPayload<E>>) -> Self { fn from(value: BlockContentsTuple<E, FullPayload<E>>) -> Self {
match value.1 { match value.1 {
Some(variable_list) => Self::BlockAndBlobs( Some(variable_list) => {
Arc::new(value.0), let mut blobs = Vec::with_capacity(E::max_blobs_per_block());
Vec::from(variable_list) for blob in variable_list {
.into_iter() if blob.message.index < E::max_blobs_per_block() as u64 {
.map(|signed_blob| signed_blob.message) blobs.insert(blob.message.index as usize, Some(blob.message));
.collect::<Vec<_>>(), }
), }
Self::BlockAndBlobs(Arc::new(value.0), FixedVector::from(blobs))
}
None => Self::Block(Arc::new(value.0)), None => Self::Block(Arc::new(value.0)),
} }
} }