File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
beacon_node/beacon_chain/src Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -524,15 +524,26 @@ impl<T: BeaconChainTypes> BeaconBlockStreamer<T> {
524
524
db_blocks
525
525
}
526
526
527
- // Pre-process the loaded blocks into execution engine requests, preserving the order of the blocks.
527
+ /// Pre-process the loaded blocks into execution engine requests.
528
+ ///
529
+ /// The purpose of this function is to separate the blocks into 3 categories:
530
+ /// 1) no_request - when we already have the full block or there's an error
531
+ /// 2) blocks_by_range - used for finalized blinded blocks
532
+ /// 3) blocks_by_root - used for unfinalized blinded blocks
533
+ ///
534
+ /// The function returns a mapping of (block_root -> request) as well as a vector
535
+ /// of block roots so that we can return the blocks in the same order they were
536
+ /// requested
528
537
async fn get_requests (
529
538
& self ,
530
539
payloads : Vec < ( Hash256 , LoadResult < T :: EthSpec > ) > ,
531
540
) -> ( Vec < Hash256 > , HashMap < Hash256 , EngineRequest < T :: EthSpec > > ) {
532
541
let mut ordered_block_roots = Vec :: new ( ) ;
533
542
let mut requests = HashMap :: new ( ) ;
534
543
535
- // separate off the by_range blocks so they can be sorted and then processed
544
+ // we sort the by range blocks by slot before adding them to the
545
+ // request as it should *better* optimize the number of blocks that
546
+ // can fit in the same request
536
547
let mut by_range_blocks: Vec < BlockParts < T :: EthSpec > > = vec ! [ ] ;
537
548
let mut by_hash = EngineRequest :: new_by_hash ( ) ;
538
549
let mut no_request = EngineRequest :: new_no_request ( ) ;
You can’t perform that action at this time.
0 commit comments