core: stop storage items reset after the first persist error

It's a bug, we mustn't continue if something bad had happend on persist,
otherwise this error will be overwritten by subsequent successfull persist.
This commit is contained in:
Anna Shaleva 2022-11-18 12:55:37 +03:00
parent 235518eb6c
commit bfe7aeae7b

View file

@ -770,6 +770,9 @@ func (bc *Blockchain) resetStateInternal(height uint32, stage stateChangeStage)
contractIDsCnt int contractIDsCnt int
) )
trieStore.Seek(storage.SeekRange{Prefix: []byte{byte(oldStoragePrefix)}}, func(k, v []byte) bool { trieStore.Seek(storage.SeekRange{Prefix: []byte{byte(oldStoragePrefix)}}, func(k, v []byte) bool {
if seekErr != nil {
return false
}
if cnt >= persistBatchSize { if cnt >= persistBatchSize {
cnt = 0 cnt = 0
keys, seekErr = cache.Persist() keys, seekErr = cache.Persist()