@@ -161,7 +161,7 @@ type backfiller interface {
161
161
// on initial startup.
162
162
//
163
163
// 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 .
165
165
suspend () * types.Header
166
166
167
167
// 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) {
382
382
done := make (chan struct {})
383
383
go func () {
384
384
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 )
393
396
}
394
397
}()
395
398
// Wait for the suspend to finish, consuming head events in the meantime
@@ -1138,7 +1141,7 @@ func (s *skeleton) cleanStales(filled *types.Header) error {
1138
1141
// The skeleton chain is partially consumed, set the new tail as filled+1.
1139
1142
tail := rawdb .ReadSkeletonHeader (s .db , number + 1 )
1140
1143
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 ())
1142
1145
}
1143
1146
start , end = s .progress .Subchains [0 ].Tail , number + 1 // remove headers in [tail, filled]
1144
1147
s .progress .Subchains [0 ].Tail = tail .Number .Uint64 ()
0 commit comments