From b4d1ebf54a5c5f1b18f62dd6736810335a7c65f1 Mon Sep 17 00:00:00 2001
From: Neil Alexander <neilalexander@users.noreply.github.com>
Date: Fri, 16 Apr 2021 14:01:37 +0100
Subject: [PATCH] Clean up a bit

---
 roomserver/state/state.go            |  5 -----
 roomserver/storage/shared/storage.go | 21 ---------------------
 2 files changed, 26 deletions(-)

diff --git a/roomserver/state/state.go b/roomserver/state/state.go
index 79bc1577..0d9511ac 100644
--- a/roomserver/state/state.go
+++ b/roomserver/state/state.go
@@ -25,7 +25,6 @@ import (
 	"github.com/matrix-org/dendrite/roomserver/storage"
 	"github.com/matrix-org/util"
 	"github.com/prometheus/client_golang/prometheus"
-	"github.com/sirupsen/logrus"
 
 	"github.com/matrix-org/dendrite/roomserver/types"
 	"github.com/matrix-org/gomatrixserverlib"
@@ -62,18 +61,14 @@ func (v *StateResolution) LoadStateAtSnapshot(
 	if err != nil {
 		return nil, err
 	}
-	logrus.Warn("LISTS: ", stateEntryLists)
 	stateEntriesMap := stateEntryListMap(stateEntryLists)
-	logrus.Warn("Map: ", stateEntriesMap)
 
 	// Combine all the state entries for this snapshot.
 	// The order of state block NIDs in the list tells us the order to combine them in.
 	var fullState []types.StateEntry
 	for _, stateBlockNID := range stateBlockNIDList.StateBlockNIDs {
-		logrus.Warn("Looking up ", stateBlockNID)
 		entries, ok := stateEntriesMap.lookup(stateBlockNID)
 		if !ok {
-			logrus.Warnf("State block NID %d: %+v", stateBlockNID, entries)
 			// This should only get hit if the database is corrupt.
 			// It should be impossible for an event to reference a NID that doesn't exist
 			panic(fmt.Errorf("Corrupt DB: Missing state block numeric ID %d", stateBlockNID))
diff --git a/roomserver/storage/shared/storage.go b/roomserver/storage/shared/storage.go
index 03c3f43b..e60dbfad 100644
--- a/roomserver/storage/shared/storage.go
+++ b/roomserver/storage/shared/storage.go
@@ -130,31 +130,10 @@ func (d *Database) StateEntriesForTuples(
 		if err != nil {
 			return nil, fmt.Errorf("d.EventsTable.BulkSelectStateEventByNID: %w", err)
 		}
-		//if len(stateKeyTuples) == 0 {
 		lists = append(lists, types.StateEntryList{
 			StateBlockNID: stateBlockNIDs[i],
 			StateEntries:  entries,
 		})
-		/*} else {
-			eventTypes := map[types.EventTypeNID]struct{}{}
-			stateKeys := map[types.EventStateKeyNID]struct{}{}
-			for _, t := range stateKeyTuples {
-				eventTypes[t.EventTypeNID] = struct{}{}
-				stateKeys[t.EventStateKeyNID] = struct{}{}
-			}
-			filteredEntries := []types.StateEntry{}
-			for _, entry := range entries {
-				_, tok := eventTypes[entry.EventTypeNID]
-				_, sok := stateKeys[entry.EventStateKeyNID]
-				if tok && sok {
-					filteredEntries = append(filteredEntries, entry)
-				}
-			}
-			lists = append(lists, types.StateEntryList{
-				StateBlockNID: stateBlockNIDs[i],
-				StateEntries:  filteredEntries,
-			})
-		}*/
 	}
 	return lists, nil
 }