File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -743,17 +743,21 @@ 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 ( .. ) => {
746+ State :: SnapshotHeader ( hash , _ ) => {
747747 for header in headers {
748- match self . client . import_bootstrap_header ( & header) {
749- Err ( BlockImportError :: Import ( ImportError :: AlreadyInChain ) ) => { }
750- Err ( BlockImportError :: Import ( ImportError :: AlreadyQueued ) ) => { }
751- // FIXME: handle import errors
752- Err ( err) => {
753- cwarn ! ( SYNC , "Cannot import header({}): {:?}" , header. hash( ) , err) ;
754- break
748+ if header. hash ( ) == hash {
749+ match self . client . import_bootstrap_header ( & header) {
750+ Err ( BlockImportError :: Import ( ImportError :: AlreadyInChain ) ) => {
751+ self . state = State :: SnapshotChunk ( * header. state_root ( ) ) ;
752+ }
753+ Err ( BlockImportError :: Import ( ImportError :: AlreadyQueued ) ) => { }
754+ // FIXME: handle import errors
755+ Err ( err) => {
756+ cwarn ! ( SYNC , "Cannot import header({}): {:?}" , header. hash( ) , err) ;
757+ break
758+ }
759+ _ => { }
755760 }
756- _ => { }
757761 }
758762 }
759763 }
You can’t perform that action at this time.
0 commit comments