From baf24d1c66c5e91f73af4e5b5410202019f82a8e Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Mon, 5 Sep 2022 17:30:58 +0300 Subject: [PATCH] nns: check domain expiration for read functions Port https://github.com/nspcc-dev/neofs-contract/pull/139/commits/432c02a3696e42a03863dbe3fae2a889ec8224e6. --- examples/nft-nd-nns/nns.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/nft-nd-nns/nns.go b/examples/nft-nd-nns/nns.go index f9aaadb44..90ffa08cf 100644 --- a/examples/nft-nd-nns/nns.go +++ b/examples/nft-nd-nns/nns.go @@ -448,7 +448,12 @@ func getTokenKey(tokenID []byte) []byte { // getNameState returns domain name state by the specified tokenID. func getNameState(ctx storage.Context, tokenID []byte) NameState { tokenKey := getTokenKey(tokenID) - return getNameStateWithKey(ctx, tokenKey) + ns := getNameStateWithKey(ctx, tokenKey) + fragments := std.StringSplit(string(tokenID), ".") + if parentExpired(ctx, 1, fragments) { + panic("parent domain has expired") + } + return ns } // getNameStateWithKey returns domain name state by the specified token key.