examples: fix owner's verification of Runtime example contract

`update` and `destroy` methods of the contract should check for owner
witness without checking the trigger (and that's the way how Verify
method works for this contract).

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
Anna Shaleva 2023-05-19 12:55:52 +03:00
parent d463bad96f
commit 35c3518b37

View file

@ -65,7 +65,7 @@ func Verify() bool {
// Destroy destroys the contract, only the owner can do that. // Destroy destroys the contract, only the owner can do that.
func Destroy() { func Destroy() {
if !Verify() { if !CheckWitness() {
panic("only owner can destroy") panic("only owner can destroy")
} }
management.Destroy() management.Destroy()
@ -74,7 +74,7 @@ func Destroy() {
// Update updates the contract, only the owner can do that. _deploy will be called // Update updates the contract, only the owner can do that. _deploy will be called
// after update. // after update.
func Update(nef, manifest []byte) { func Update(nef, manifest []byte) {
if !Verify() { if !CheckWitness() {
panic("only owner can update") panic("only owner can update")
} }
management.Update(nef, manifest) management.Update(nef, manifest)