From 840e206963a576fe526b43362b6ccb03da1aa1f0 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Mon, 22 Nov 2021 15:19:33 +0300 Subject: [PATCH] [#174] subnet: Fix notification Add notification to the `Delete` method and add subnet ID to the `Put` notification. Signed-off-by: Pavel Karpy --- subnet/config.yml | 7 ++++++- subnet/subnet_contract.go | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/subnet/config.yml b/subnet/config.yml index db13b90..9ea4209 100644 --- a/subnet/config.yml +++ b/subnet/config.yml @@ -5,8 +5,13 @@ permissions: events: - name: SubnetPut parameters: + - name: id + type: ByteArray - name: ownerKey type: PublicKey - name: info type: ByteArray - + - name: SubnetDelete + parameters: + - name: id + type: ByteArray diff --git a/subnet/subnet_contract.go b/subnet/subnet_contract.go index dec7aad..bedaba7 100644 --- a/subnet/subnet_contract.go +++ b/subnet/subnet_contract.go @@ -80,7 +80,7 @@ func Put(id []byte, ownerKey interop.PublicKey, info []byte) { if !runtime.CheckWitness(ownerKey) { panic("put: witness check failed") } - runtime.Notify("SubnetPut", ownerKey, info) + runtime.Notify("SubnetPut", id, ownerKey, info) return } @@ -137,6 +137,8 @@ func Delete(id []byte) { key[0] = infoPrefix storage.Delete(ctx, key) + + runtime.Notify("SubnetDelete", id) } // AddNodeAdmin adds new node administrator to the specified subnetwork.