core: restrict the maximum number of contract updates

This commit is contained in:
Anna Shaleva 2022-05-04 13:37:18 +03:00
parent 42e4021898
commit ffdcdf4a95

View file

@ -353,6 +353,9 @@ func (m *Management) Update(d *dao.Simple, hash util.Uint160, neff *nef.File, ma
if err != nil {
return nil, errors.New("contract doesn't exist")
}
if oldcontract.UpdateCounter == math.MaxUint16 {
return nil, errors.New("the contract reached the maximum number of updates")
}
contract = *oldcontract // Make a copy, don't ruin (potentially) cached contract.
// if NEF was provided, update the contract script