@@ -560,13 +560,10 @@ func (dl *diskLayer) generate(stats *generatorStats) {
560560 default :
561561 }
562562 if batch .ValueSize () > ethdb .IdealBatchSize || abort != nil {
563- // currentLocation may lost its `storageHash` part, when currentLocation
564- // and dl.genMarker has the same `accountHash` part and abort generation
565- // before this function is firstly called in onAccount function,
566- // which will result in ignoring updating the storage snapshot of
567- // that `accountHash`, thus the value in the cache of diskLayer will be an old one.
568563 if bytes .Compare (currentLocation , dl .genMarker ) < 0 {
569- currentLocation = dl .genMarker
564+ log .Error ("Snapshot generator went backwards" ,
565+ "currentLocation" , fmt .Sprintf ("%x" , currentLocation ),
566+ "genMarker" , fmt .Sprintf ("%x" , dl .genMarker ))
570567 }
571568
572569 // Flush out the batch anyway no matter it's empty or not.
@@ -644,7 +641,11 @@ func (dl *diskLayer) generate(stats *generatorStats) {
644641 stats .accounts ++
645642 }
646643 // If we've exceeded our batch allowance or termination was requested, flush to disk
647- if err := checkAndFlush (accountHash [:]); err != nil {
644+ marker := accountHash [:]
645+ if accMarker != nil && bytes .Equal (accountHash [:], accMarker ) && len (dl .genMarker ) > common .HashLength {
646+ marker = append (marker , dl .genMarker [common .HashLength :]... )
647+ }
648+ if err := checkAndFlush (marker ); err != nil {
648649 return err
649650 }
650651 // If the iterated account is the contract, create a further loop to
0 commit comments