chore: BlobsBundle::take (#4925)

This commit is contained in:
Roman Krasiuk
2023-10-05 21:34:02 +03:00
committed by GitHub
parent 442f28a8f2
commit a9b09a7552

View File

@ -242,6 +242,21 @@ impl From<Vec<BlobTransactionSidecar>> for BlobsBundleV1 {
}
}
impl BlobsBundleV1 {
/// Take `len` blob data from the bundle.
///
/// # Panics
///
/// If len is more than the blobs bundle len.
pub fn take(&mut self, len: usize) -> (Vec<Bytes48>, Vec<Bytes48>, Vec<Blob>) {
(
self.commitments.drain(0..len).collect(),
self.proofs.drain(0..len).collect(),
self.blobs.drain(0..len).collect(),
)
}
}
/// An execution payload, which can be either [ExecutionPayloadV1], [ExecutionPayloadV2], or
/// [ExecutionPayloadV3].
#[derive(Clone, Debug, PartialEq, Eq)]