File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -722,20 +722,28 @@ impl Extension {
722722 fn on_header_response ( & mut self , from : & NodeId , headers : & [ Header ] ) {
723723 ctrace ! ( SYNC , "Received header response from({}) with length({})" , from, headers. len( ) ) ;
724724 match self . state {
725- State :: SnapshotHeader ( .. ) => {
726- for header in headers {
725+ State :: SnapshotHeader ( hash , _ ) => match headers {
726+ [ header ] if header. hash ( ) == hash => {
727727 match self . client . import_bootstrap_header ( & header) {
728- Err ( BlockImportError :: Import ( ImportError :: AlreadyInChain ) ) => { }
728+ Err ( BlockImportError :: Import ( ImportError :: AlreadyInChain ) ) => {
729+ self . state = State :: SnapshotChunk ( * header. state_root ( ) ) ;
730+ }
729731 Err ( BlockImportError :: Import ( ImportError :: AlreadyQueued ) ) => { }
730732 // FIXME: handle import errors
731733 Err ( err) => {
732734 cwarn ! ( SYNC , "Cannot import header({}): {:?}" , header. hash( ) , err) ;
733- break
734735 }
735736 _ => { }
736737 }
737738 }
738- }
739+ _ => cdebug ! (
740+ SYNC ,
741+ "Peer {} responded with a invalid response. requested hash: {}, response length: {}" ,
742+ from,
743+ hash,
744+ headers. len( )
745+ ) ,
746+ } ,
739747 State :: SnapshotChunk ( ..) => { }
740748 State :: Full => {
741749 let ( mut completed, pivot_score_changed) = if let Some ( peer) = self . header_downloaders . get_mut ( from) {
You can’t perform that action at this time.
0 commit comments