@@ -161,7 +161,7 @@ type backfiller interface {
161161 // on initial startup.
162162 //
163163 // The method should return the last block header that has been successfully
164- // backfilled, or nil if the backfiller was not resumed .
164+ // backfilled (in the current or a previous run), falling back to the genesis .
165165 suspend () * types.Header
166166
167167 // resume requests the backfiller to start running fill or snap sync based on
@@ -382,14 +382,17 @@ func (s *skeleton) sync(head *types.Header) (*types.Header, error) {
382382 done := make (chan struct {})
383383 go func () {
384384 defer close (done )
385- if filled := s .filler .suspend (); filled != nil {
386- // If something was filled, try to delete stale sync helpers. If
387- // unsuccessful, warn the user, but not much else we can do (it's
388- // a programming error, just let users report an issue and don't
389- // choke in the meantime).
390- if err := s .cleanStales (filled ); err != nil {
391- log .Error ("Failed to clean stale beacon headers" , "err" , err )
392- }
385+ filled := s .filler .suspend ()
386+ if filled == nil {
387+ log .Error ("Latest filled block is not available" )
388+ return
389+ }
390+ // If something was filled, try to delete stale sync helpers. If
391+ // unsuccessful, warn the user, but not much else we can do (it's
392+ // a programming error, just let users report an issue and don't
393+ // choke in the meantime).
394+ if err := s .cleanStales (filled ); err != nil {
395+ log .Error ("Failed to clean stale beacon headers" , "err" , err )
393396 }
394397 }()
395398 // Wait for the suspend to finish, consuming head events in the meantime
@@ -1138,7 +1141,7 @@ func (s *skeleton) cleanStales(filled *types.Header) error {
11381141 // The skeleton chain is partially consumed, set the new tail as filled+1.
11391142 tail := rawdb .ReadSkeletonHeader (s .db , number + 1 )
11401143 if tail .ParentHash != filled .Hash () {
1141- return fmt .Errorf ("filled header is discontinuous with subchain: %d %s" , number , filled .Hash ())
1144+ return fmt .Errorf ("filled header is discontinuous with subchain: %d %s, please file an issue " , number , filled .Hash ())
11421145 }
11431146 start , end = s .progress .Subchains [0 ].Tail , number + 1 // remove headers in [tail, filled]
11441147 s .progress .Subchains [0 ].Tail = tail .Number .Uint64 ()
0 commit comments