nns: check domain expiration for read functions

Port 432c02a369.
This commit is contained in:
Anna Shaleva 2022-09-05 17:30:58 +03:00
parent 017a6b9bc1
commit baf24d1c66

View file

@ -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.