diff --git a/policy/policy_contract.go b/policy/policy_contract.go index dc1a71f..398468b 100644 --- a/policy/policy_contract.go +++ b/policy/policy_contract.go @@ -68,22 +68,10 @@ func RemoveChainsByPrefix(entity Kind, entityName string, name string) { // ListChains lists all chains for the namespace by prefix. // container may be empty. func ListChains(namespace, container, name string) [][]byte { - ctx := storage.GetReadOnlyContext() - - var result [][]byte - - prefixNs := storageKey(Namespace, namespace, name) - it := storage.Find(ctx, prefixNs, storage.ValuesOnly) - for iterator.Next(it) { - result = append(result, iterator.Value(it).([]byte)) - } + result := ListChainsByPrefix(Namespace, namespace, name) if container != "" { - prefixCnr := storageKey(Container, container, name) - it = storage.Find(ctx, prefixCnr, storage.ValuesOnly) - for iterator.Next(it) { - result = append(result, iterator.Value(it).([]byte)) - } + result = append(result, ListChainsByPrefix(Container, container, name)...) } return result diff --git a/tests/policy_test.go b/tests/policy_test.go index 56a41b8..d484d5a 100644 --- a/tests/policy_test.go +++ b/tests/policy_test.go @@ -89,12 +89,6 @@ func checkChainsByPrefix(t *testing.T, e *neotest.ContractInvoker, kind byte, en func checksChainsOnStack(t *testing.T, s *vm.Stack, expected [][]byte) { require.Equal(t, 1, s.Len()) - if len(expected) == 0 { - _, ok := s.Pop().Item().(stackitem.Null) - require.True(t, ok) - return - } - var actual [][]byte arr := s.Pop().Array() for i := range arr {