@@ -199,45 +199,41 @@ func (syncer *Syncer) syncOne(ctx context.Context, parent, next *types.TipSet) e
199199 stopwatch := syncOneTimer .Start ()
200200 defer stopwatch (ctx )
201201
202- var err error
203-
204- if ! parent .Key ().Equals (syncer .chainStore .GetCheckPoint ().Key ()) {
205- var wg errgroup.Group
206- for i := 0 ; i < next .Len (); i ++ {
207- blk := next .At (i )
208- wg .Go (func () error {
209- // Fetch the URL.
210- err := syncer .blockValidator .ValidateFullBlock (ctx , blk )
211- if err == nil {
212- if err := syncer .chainStore .AddToTipSetTracker (ctx , blk ); err != nil {
213- return fmt .Errorf ("failed to add validated header to tipset tracker: %w" , err )
214- }
202+ var wg errgroup.Group
203+ for i := 0 ; i < next .Len (); i ++ {
204+ blk := next .At (i )
205+ wg .Go (func () error {
206+ // Fetch the URL.
207+ err := syncer .blockValidator .ValidateFullBlock (ctx , blk )
208+ if err == nil {
209+ if err := syncer .chainStore .AddToTipSetTracker (ctx , blk ); err != nil {
210+ return fmt .Errorf ("failed to add validated header to tipset tracker: %w" , err )
215211 }
216- return err
217- })
218- }
219- err = wg .Wait ()
220- if err != nil {
221- var rootNotMatch bool // nolint
222-
223- if merr , isok := err .(* multierror.Error ); isok {
224- for _ , e := range merr .Errors {
225- if isRootNotMatch (e ) {
226- rootNotMatch = true
227- break
228- }
229- }
230- } else {
231- rootNotMatch = isRootNotMatch (err ) // nolint
232212 }
213+ return err
214+ })
215+ }
216+ err := wg .Wait ()
217+ if err != nil {
218+ var rootNotMatch bool // nolint
233219
234- if rootNotMatch { // nolint
235- // todo: should here rollback, and re-compute?
236- _ = syncer .stmgr .Rollback (ctx , parent , next )
220+ if merr , isok := err .(* multierror.Error ); isok {
221+ for _ , e := range merr .Errors {
222+ if isRootNotMatch (e ) {
223+ rootNotMatch = true
224+ break
225+ }
237226 }
227+ } else {
228+ rootNotMatch = isRootNotMatch (err ) // nolint
229+ }
238230
239- return fmt .Errorf ("validate mining failed %w" , err )
231+ if rootNotMatch { // nolint
232+ // todo: should here rollback, and re-compute?
233+ _ = syncer .stmgr .Rollback (ctx , parent , next )
240234 }
235+
236+ return fmt .Errorf ("validate mining failed %w" , err )
241237 }
242238
243239 syncer .chainStore .PersistTipSetKey (ctx , next .Key ())
0 commit comments