@@ -152,6 +152,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
152152 if let Some ( components) = child_components {
153153 lookup. add_child_components ( components) ;
154154 }
155+ debug ! ( self . log, "Already searching for block" ; "block_root" => ?block_root) ;
155156 return ;
156157 }
157158
@@ -162,6 +163,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
162163
163164 // If the block was already downloaded, or is being downloaded in this moment, do not
164165 // request it.
166+ debug ! ( self . log, "Already searching for block in a parent lookup request" ; "block_root" => ?block_root) ;
165167 return ;
166168 }
167169
@@ -171,6 +173,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
171173 . any ( |( hashes, _last_parent_request) | hashes. contains ( & block_root) )
172174 {
173175 // we are already processing this block, ignore it.
176+ debug ! ( self . log, "Already processing block in a parent request" ; "block_root" => ?block_root) ;
174177 return ;
175178 }
176179
@@ -221,15 +224,23 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
221224 } ) {
222225 parent_lookup. add_peer ( peer_id) ;
223226 // we are already searching for this block, ignore it
227+ debug ! ( self . log, "Already searching for parent block" ;
228+ "block_root" => ?block_root, "parent_root" => ?parent_root) ;
224229 return ;
225230 }
226231
227232 if self
228233 . processing_parent_lookups
229- . values ( )
230- . any ( |( hashes, _peers) | hashes. contains ( & block_root) || hashes. contains ( & parent_root) )
234+ . iter ( )
235+ . any ( |( chain_hash, ( hashes, _peers) ) | {
236+ chain_hash == & block_root
237+ || hashes. contains ( & block_root)
238+ || hashes. contains ( & parent_root)
239+ } )
231240 {
232241 // we are already processing this block, ignore it.
242+ debug ! ( self . log, "Already processing parent block" ;
243+ "block_root" => ?block_root, "parent_root" => ?parent_root) ;
233244 return ;
234245 }
235246 let parent_lookup = ParentLookup :: new (
@@ -298,6 +309,12 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
298309 } ;
299310
300311 let expected_block_root = lookup. block_root ( ) ;
312+ debug ! ( self . log,
313+ "Peer returned block for single lookup" ;
314+ "peer_id" => %peer_id ,
315+ "id" => ?id,
316+ "block_root" => ?expected_block_root,
317+ ) ;
301318
302319 match self . single_lookup_response_inner :: < R > ( peer_id, response, seen_timestamp, cx, lookup)
303320 {
@@ -478,6 +495,13 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
478495 return ;
479496 } ;
480497
498+ debug ! ( self . log,
499+ "Peer returned block for parent lookup" ;
500+ "peer_id" => %peer_id ,
501+ "id" => ?id,
502+ "block_root" => ?parent_lookup. current_parent_request. block_request_state. requested_block_root,
503+ ) ;
504+
481505 match self . parent_lookup_response_inner :: < R > (
482506 peer_id,
483507 response,
@@ -540,7 +564,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
540564 | ParentVerifyError :: NoBlockReturned
541565 | ParentVerifyError :: NotEnoughBlobsReturned
542566 | ParentVerifyError :: ExtraBlocksReturned
543- | ParentVerifyError :: UnrequestedBlobId
567+ | ParentVerifyError :: UnrequestedBlobId ( _ )
544568 | ParentVerifyError :: ExtraBlobsReturned
545569 | ParentVerifyError :: InvalidIndex ( _) => {
546570 let e = e. into ( ) ;
@@ -728,6 +752,8 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
728752 "Block component processed for lookup" ;
729753 "response_type" => ?R :: response_type( ) ,
730754 "block_root" => ?root,
755+ "result" => ?result,
756+ "id" => target_id,
731757 ) ;
732758
733759 match result {
@@ -901,7 +927,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
901927 debug ! ( self . log, "Parent block processing succeeded" ; & parent_lookup, "block_root" => ?block_root)
902928 }
903929 AvailabilityProcessingStatus :: MissingComponents ( _, block_root) => {
904- debug ! ( self . log, "Parent missing parts, triggering single block lookup " ; & parent_lookup, "block_root" => ?block_root)
930+ debug ! ( self . log, "Parent missing parts, triggering single block lookup" ; & parent_lookup, "block_root" => ?block_root)
905931 }
906932 } ,
907933 BlockProcessingResult :: Err ( e) => {
@@ -1223,7 +1249,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
12231249 ) -> Result < ( ) , LookupRequestError > {
12241250 match cx. beacon_processor_if_enabled ( ) {
12251251 Some ( beacon_processor) => {
1226- trace ! ( self . log, "Sending block for processing" ; "block" => ?block_root, "process" => ?process_type) ;
1252+ debug ! ( self . log, "Sending block for processing" ; "block" => ?block_root, "process" => ?process_type) ;
12271253 if let Err ( e) = beacon_processor. send_rpc_beacon_block (
12281254 block_root,
12291255 block,
0 commit comments