@@ -176,26 +176,28 @@ func mainCore() error {
176176 }
177177
178178 var newPGIndexes , updateAllAddresses bool
179- heightDB , err := db .HeightDB ()
180- if err != nil {
181- if err != sql .ErrNoRows {
182- return fmt .Errorf ("Unable to get height from PostgreSQL DB: %v" , err )
179+ if usePG {
180+ heightDB , err := db .HeightDB ()
181+ if err != nil {
182+ if err != sql .ErrNoRows {
183+ return fmt .Errorf ("Unable to get height from PostgreSQL DB: %v" , err )
184+ }
185+ heightDB = 0
183186 }
184- heightDB = 0
185- }
186- blocksBehind := height - int64 (heightDB )
187- if blocksBehind < 0 {
188- return fmt .Errorf ("Node is still syncing. Node height = %d, " +
189- "DB height = %d" , height , heightDB )
190- }
191- if blocksBehind > 7500 {
192- log .Infof ("Setting PSQL sync to rebuild address table after large " +
193- "import (%d blocks)." , blocksBehind )
194- updateAllAddresses = true
195- if blocksBehind > 40000 {
196- log .Infof ("Setting PSQL sync to drop indexes prior to bulk data " +
187+ blocksBehind := height - int64 (heightDB )
188+ if blocksBehind < 0 {
189+ return fmt .Errorf ("Node is still syncing. Node height = %d, " +
190+ "DB height = %d" , height , heightDB )
191+ }
192+ if blocksBehind > 7500 {
193+ log .Infof ("Setting PSQL sync to rebuild address table after large " +
197194 "import (%d blocks)." , blocksBehind )
198- newPGIndexes = true
195+ updateAllAddresses = true
196+ if blocksBehind > 40000 {
197+ log .Infof ("Setting PSQL sync to drop indexes prior to bulk data " +
198+ "import (%d blocks)." , blocksBehind )
199+ newPGIndexes = true
200+ }
199201 }
200202 }
201203
0 commit comments