Skip to content

Commit

Permalink
perf: only filter once
Browse files Browse the repository at this point in the history
  • Loading branch information
johntaiko committed Apr 22, 2024
1 parent b588bb2 commit e1f5d41
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions host/src/preflight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,17 +104,16 @@ pub fn preflight(
let blobs = get_blob_data(&beacon_rpc_url.clone().unwrap(), slot_id)?;
assert!(!blobs.data.is_empty(), "blob data not available anymore");
// Get the blob data for the blob storing the tx list
let tx_blobs: Vec<GetBlobData> = blobs
let tx_blob = blobs
.data
.iter()
.filter(|blob: &&GetBlobData| {
.find(|blob| {
// calculate from plain blob
blob_hash == calc_blob_versioned_hash(&blob.blob)
})
.cloned()
.collect::<Vec<GetBlobData>>();
assert!(!tx_blobs.is_empty());
(blob_to_bytes(&tx_blobs[0].blob), Some(blob_hash))
.cloned();
assert!(tx_blob.is_some());
(blob_to_bytes(&tx_blob.unwrap().blob), Some(blob_hash))
} else {
// Get the tx list data directly from the propose transaction data
let proposal_call = proposeBlockCall::abi_decode(&proposal_tx.input, false).unwrap();
Expand Down

0 comments on commit e1f5d41

Please sign in to comment.