forked from TrueCloudLab/neoneo-go
core: fix state reset with broken contract
Sync up with #2802, bad contract -> no contract ID at all.
This commit is contained in:
parent
ecda07736e
commit
f52451e582
1 changed files with 7 additions and 5 deletions
|
@ -795,12 +795,14 @@ func (bc *Blockchain) resetStateInternal(height uint32, stage stateChangeStage)
|
|||
copy(hash[:], k[mgmtCSPrefixLen:])
|
||||
err = stackitem.DeserializeConvertible(v, cs)
|
||||
if err != nil {
|
||||
seekErr = fmt.Errorf("failed to deserialize contract %s state: %w", hash.StringLE(), seekErr)
|
||||
return false
|
||||
bc.log.Warn("failed to deserialize contract; ID for this contract won't be stored in the DB",
|
||||
zap.String("hash", hash.StringLE()),
|
||||
zap.Error(err))
|
||||
} else {
|
||||
cache.PutContractID(cs.ID, hash)
|
||||
cnt++
|
||||
contractIDsCnt++
|
||||
}
|
||||
cache.PutContractID(cs.ID, hash)
|
||||
cnt++
|
||||
contractIDsCnt++
|
||||
}
|
||||
|
||||
return true
|
||||
|
|
Loading…
Reference in a new issue