[#130] Panic at contract update failures

There is no practical cases not to panic at contract
update routine.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-09-21 15:58:37 +03:00 committed by Alex Vanin
parent b555e200f4
commit edd4864e39
10 changed files with 20 additions and 50 deletions

View file

@ -51,18 +51,15 @@ func _deploy(data interface{}, isUpdate bool) {
// Update method updates contract source code and manifest. Can be invoked
// only by contract owner.
func Update(script []byte, manifest []byte, data interface{}) bool {
func Update(script []byte, manifest []byte, data interface{}) {
ctx := storage.GetReadOnlyContext()
if !common.HasUpdateAccess(ctx) {
runtime.Log("only owner can update contract")
return false
panic("only owner can update contract")
}
contract.Call(interop.Hash160(management.Hash), "update", contract.All, script, manifest, data)
runtime.Log("processing contract updated")
return true
}
// Verify method returns true if transaction contains valid multi signature of