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 @@ -743,20 +743,28 @@ impl Extension {
743743 fn on_header_response ( & mut self , from : & NodeId , headers : & [ Header ] ) {
744744 ctrace ! ( SYNC , "Received header response from({}) with length({})" , from, headers. len( ) ) ;
745745 match self . state {
746- State :: SnapshotHeader ( .. ) => {
747- for header in headers {
746+ State :: SnapshotHeader ( hash , _ ) => match headers {
747+ [ header ] if header. hash ( ) == hash => {
748748 match self . client . import_bootstrap_header ( & header) {
749- Err ( BlockImportError :: Import ( ImportError :: AlreadyInChain ) ) => { }
749+ Err ( BlockImportError :: Import ( ImportError :: AlreadyInChain ) ) => {
750+ self . state = State :: SnapshotChunk ( * header. state_root ( ) ) ;
751+ }
750752 Err ( BlockImportError :: Import ( ImportError :: AlreadyQueued ) ) => { }
751753 // FIXME: handle import errors
752754 Err ( err) => {
753755 cwarn ! ( SYNC , "Cannot import header({}): {:?}" , header. hash( ) , err) ;
754- break
755756 }
756757 _ => { }
757758 }
758759 }
759- }
760+ _ => cdebug ! (
761+ SYNC ,
762+ "Peer {} responded with a invalid response. requested hash: {}, response length: {}" ,
763+ from,
764+ hash,
765+ headers. len( )
766+ ) ,
767+ } ,
760768 State :: SnapshotChunk ( ..) => { }
761769 State :: Full => {
762770 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