From 1b39db664c24625f5efbd0ddbbe5b94081ba1c13 Mon Sep 17 00:00:00 2001 From: CalDescent Date: Fri, 27 Aug 2021 08:54:46 +0100 Subject: [PATCH] Added missing ATStatesHeightIndex to the reshape code. This was accidentally missed out of the original code. Some pre-updated nodes on the network will be missing this index, but we can use the upcoming "auto-bootstrap" feature to get those back. --- .../org/qortal/repository/hsqldb/HSQLDBDatabaseUpdates.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabaseUpdates.java b/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabaseUpdates.java index 2e399be1..683a2c3b 100644 --- a/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabaseUpdates.java +++ b/src/main/java/org/qortal/repository/hsqldb/HSQLDBDatabaseUpdates.java @@ -837,6 +837,11 @@ public class HSQLDBDatabaseUpdates { stmt.execute("SET TABLE ATStatesNew NEW SPACE"); stmt.execute("CHECKPOINT"); + // Add the height index + LOGGER.info("Adding index to AT states table..."); + stmt.execute("CREATE INDEX ATStatesNewHeightIndex ON ATStatesNew (height)"); + stmt.execute("CHECKPOINT"); + ResultSet resultSet = stmt.executeQuery("SELECT height FROM Blocks ORDER BY height DESC LIMIT 1"); final int blockchainHeight = resultSet.next() ? resultSet.getInt(1) : 0; final int heightStep = 100; @@ -858,6 +863,7 @@ public class HSQLDBDatabaseUpdates { stmt.execute("DROP TABLE ATStates"); stmt.execute("ALTER TABLE ATStatesNew RENAME TO ATStates"); + stmt.execute("ALTER INDEX ATStatesNewHeightIndex RENAME TO ATStatesHeightIndex"); stmt.execute("CHECKPOINT"); break; }