@@ -221,11 +221,11 @@ impl<T: BeaconChainTypes> SingleBlockLookup<T> {
221
221
// with this `req_id`.
222
222
request. get_state_mut ( ) . on_download_start ( req_id) ?
223
223
}
224
- LookupRequestResult :: NoRequestNeeded => {
224
+ LookupRequestResult :: NoRequestNeeded ( reason ) => {
225
225
// Lookup sync event safety: Advances this request to the terminal `Processed`
226
226
// state. If all requests reach this state, the request is marked as completed
227
227
// in `Self::continue_requests`.
228
- request. get_state_mut ( ) . on_completed_request ( ) ?
228
+ request. get_state_mut ( ) . on_completed_request ( reason ) ?
229
229
}
230
230
// Sync will receive a future event to make progress on the request, do nothing now
231
231
LookupRequestResult :: Pending ( reason) => {
@@ -357,13 +357,13 @@ pub struct DownloadResult<T: Clone> {
357
357
358
358
#[ derive( IntoStaticStr ) ]
359
359
pub enum State < T : Clone > {
360
- AwaitingDownload ( & ' static str ) ,
360
+ AwaitingDownload ( /* reason */ & ' static str ) ,
361
361
Downloading ( ReqId ) ,
362
362
AwaitingProcess ( DownloadResult < T > ) ,
363
363
/// Request is processing, sent by lookup sync
364
364
Processing ( DownloadResult < T > ) ,
365
365
/// Request is processed
366
- Processed ,
366
+ Processed ( /* reason */ & ' static str ) ,
367
367
}
368
368
369
369
/// Object representing the state of a single block or blob lookup request.
@@ -554,7 +554,7 @@ impl<T: Clone> SingleLookupRequestState<T> {
554
554
pub fn on_processing_success ( & mut self ) -> Result < ( ) , LookupRequestError > {
555
555
match & self . state {
556
556
State :: Processing ( _) => {
557
- self . state = State :: Processed ;
557
+ self . state = State :: Processed ( "processing success" ) ;
558
558
Ok ( ( ) )
559
559
}
560
560
other => Err ( LookupRequestError :: BadState ( format ! (
@@ -564,10 +564,10 @@ impl<T: Clone> SingleLookupRequestState<T> {
564
564
}
565
565
566
566
/// Mark a request as complete without any download or processing
567
- pub fn on_completed_request ( & mut self ) -> Result < ( ) , LookupRequestError > {
567
+ pub fn on_completed_request ( & mut self , reason : & ' static str ) -> Result < ( ) , LookupRequestError > {
568
568
match & self . state {
569
569
State :: AwaitingDownload { .. } => {
570
- self . state = State :: Processed ;
570
+ self . state = State :: Processed ( reason ) ;
571
571
Ok ( ( ) )
572
572
}
573
573
other => Err ( LookupRequestError :: BadState ( format ! (
@@ -598,11 +598,11 @@ impl<T: Clone> std::fmt::Display for State<T> {
598
598
impl < T : Clone > std:: fmt:: Debug for State < T > {
599
599
fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
600
600
match self {
601
- Self :: AwaitingDownload ( status ) => write ! ( f, "AwaitingDownload({:? })" , status ) ,
601
+ Self :: AwaitingDownload ( reason ) => write ! ( f, "AwaitingDownload({})" , reason ) ,
602
602
Self :: Downloading ( req_id) => write ! ( f, "Downloading({:?})" , req_id) ,
603
603
Self :: AwaitingProcess ( d) => write ! ( f, "AwaitingProcess({:?})" , d. peer_group) ,
604
604
Self :: Processing ( d) => write ! ( f, "Processing({:?})" , d. peer_group) ,
605
- Self :: Processed { .. } => write ! ( f, "Processed" ) ,
605
+ Self :: Processed ( reason ) => write ! ( f, "Processed({})" , reason ) ,
606
606
}
607
607
}
608
608
}
0 commit comments