From fdae244b64e0af27867fcce9ad37be7f74c68358 Mon Sep 17 00:00:00 2001 From: mcrakhman Date: Tue, 31 Dec 2024 00:10:41 +0100 Subject: [PATCH] Derived fixes --- commonspace/headsync/headsync.go | 3 +++ commonspace/headsync/headupdater.go | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/commonspace/headsync/headsync.go b/commonspace/headsync/headsync.go index c118a751..0030ac92 100644 --- a/commonspace/headsync/headsync.go +++ b/commonspace/headsync/headsync.go @@ -145,6 +145,9 @@ func (h *headSync) Close(ctx context.Context) (err error) { func (h *headSync) fillDiff(ctx context.Context) error { var els = make([]ldiff.Element, 0, 100) err := h.storage.HeadStorage().IterateEntries(ctx, headstorage.IterOpts{}, func(entry headstorage.HeadsEntry) (bool, error) { + if entry.IsDerived && entry.Heads[0] == entry.Id { + return true, nil + } els = append(els, ldiff.Element{ Id: entry.Id, Head: concatStrings(entry.Heads), diff --git a/commonspace/headsync/headupdater.go b/commonspace/headsync/headupdater.go index 7d9d092c..b242e358 100644 --- a/commonspace/headsync/headupdater.go +++ b/commonspace/headsync/headupdater.go @@ -15,7 +15,8 @@ type headUpdater struct { func newHeadUpdater(update func(update headstorage.HeadsUpdate)) *headUpdater { return &headUpdater{ - batcher: mb.New[headstorage.HeadsUpdate](0), + batcher: mb.New[headstorage.HeadsUpdate](0), + updateFunc: update, } }