@@ -127,6 +127,8 @@ func loadSnapshot(database db.Database, hash common.Hash, log log.Logger) (*Snap
127
127
return nil , err
128
128
}
129
129
snap := new (Snapshot )
130
+ snap .CurrTurnLength = 1
131
+ snap .NextTurnLength = 1
130
132
if err := json .Unmarshal (blob , snap ); err != nil {
131
133
return nil , err
132
134
}
@@ -234,7 +236,7 @@ func (s *Snapshot) apply(config *params.ChainConfig, head *types.Header, cid *bi
234
236
235
237
snap := s .copy ()
236
238
number := head .Number .Uint64 ()
237
- if limit := snap .minerHistoryCheckLen () + 1 ; number >= limit {
239
+ if limit := s .minerHistoryCheckLen () + 1 ; number >= limit {
238
240
delete (snap .Recents , number - limit )
239
241
}
240
242
validator , err := ecrecover (head , cid )
@@ -246,12 +248,12 @@ func (s *Snapshot) apply(config *params.ChainConfig, head *types.Header, cid *bi
246
248
}
247
249
if config .IsBohr (head .Number , head .Time ) {
248
250
if snap .SignRecently (validator ) {
249
- return nil , errors .New ("RecentlySigned" )
251
+ return nil , errors .New ("RecentlySigned(>=Bohr) " )
250
252
}
251
253
} else {
252
254
for _ , recent := range snap .Recents {
253
255
if recent == validator {
254
- return nil , errors .New ("RecentlySigned" )
256
+ return nil , errors .New ("RecentlySigned(<Bohr) " )
255
257
}
256
258
}
257
259
}
@@ -299,6 +301,9 @@ func (s *Snapshot) apply(config *params.ChainConfig, head *types.Header, cid *bi
299
301
}
300
302
301
303
func parseTurnLength (config * params.ChainConfig , head * types.Header ) (uint8 , error ) {
304
+ if ! config .IsBohr (head .Number , head .Time ) {
305
+ return 1 , nil
306
+ }
302
307
if len (head .Extra ) <= extraVanity + extraSeal {
303
308
return 0 , errors .New ("invalid span validators" )
304
309
}
0 commit comments