Re-add existingPrevs loop

This commit is contained in:
Neil Alexander 2020-12-09 12:38:08 +00:00
parent fca342101e
commit 2ef90a65d9
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -306,6 +306,14 @@ func (u *latestEventsUpdater) calculateLatest(
delete(existingRefs, prevEventID)
}
// Ensure that we don't add any candidate forward extremities from
// the old set that are, themselves, referenced by the old set of
// forward extremities. This shouldn't happen but guards against
// the possibility anyway.
for prevEventID := range existingPrevs {
delete(existingRefs, prevEventID)
}
// Then re-add any old extremities that are still valid after all.
for _, old := range existingRefs {
newLatest = append(newLatest, *old)