From f920200be9074c26636616e738fcb87e04c85e42 Mon Sep 17 00:00:00 2001 From: mcrakhman Date: Thu, 20 Oct 2022 20:12:00 +0200 Subject: [PATCH] Raw loader and key fixes --- common/pkg/acl/tree/rawloader.go | 4 +++- node/storage/keys.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/common/pkg/acl/tree/rawloader.go b/common/pkg/acl/tree/rawloader.go index bc39688c..e6c556ff 100644 --- a/common/pkg/acl/tree/rawloader.go +++ b/common/pkg/acl/tree/rawloader.go @@ -73,7 +73,9 @@ func (r *rawChangeLoader) LoadFromTree(t *Tree, breakpoints []string) ([]*treech // now starting from breakpoints stack = stack[:0] for _, h := range breakpoints { - stack = append(stack, t.attached[h]) + if c, exists := t.attached[h]; exists { + stack = append(stack, c) + } } // doing another dfs to get all changes before breakpoints, we need to exclude them from results diff --git a/node/storage/keys.go b/node/storage/keys.go index 8792929a..85dd46aa 100644 --- a/node/storage/keys.go +++ b/node/storage/keys.go @@ -62,5 +62,5 @@ func (s spaceKeys) HeaderKey() []byte { } func isRootIdKey(key string) bool { - return strings.HasPrefix(key, "t/") && strings.HasSuffix(key, "rootId") + return strings.HasPrefix(key, "t/") && strings.HasSuffix(key, "heads") }