From ffdcdf4a95cd81b252454a74660e2df0ef573723 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Wed, 4 May 2022 13:37:18 +0300 Subject: [PATCH] core: restrict the maximum number of contract updates --- pkg/core/native/management.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/core/native/management.go b/pkg/core/native/management.go index 57bccf7ef..bd9957521 100644 --- a/pkg/core/native/management.go +++ b/pkg/core/native/management.go @@ -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