core: reset batch counter to zero after each persist in resetStateInternal

It's a bug, otherwise we'll persist each storage item after 10K-th one,
that's the reason of abnormous long storage items resetting stage.
This commit is contained in:
Anna Shaleva 2022-11-18 12:53:09 +03:00
parent 9f23fafc03
commit 235518eb6c

View file

@ -771,6 +771,7 @@ func (bc *Blockchain) resetStateInternal(height uint32, stage stateChangeStage)
)
trieStore.Seek(storage.SeekRange{Prefix: []byte{byte(oldStoragePrefix)}}, func(k, v []byte) bool {
if cnt >= persistBatchSize {
cnt = 0
keys, seekErr = cache.Persist()
if seekErr != nil {
seekErr = fmt.Errorf("failed to persist intermediate batch of contract storage items and IDs: %w", seekErr)