From bc342ec4f6debba0ec49729a660b6af38446c487 Mon Sep 17 00:00:00 2001
From: Mark Tyneway <mark.tyneway@gmail.com>
Date: Tue, 1 Feb 2022 11:57:40 -0800
Subject: [PATCH] l2geth: fix startup logic for repairing queue index

---
 .changeset/quick-tables-double.md | 5 +++++
 l2geth/rollup/sync_service.go     | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)
 create mode 100644 .changeset/quick-tables-double.md

diff --git a/.changeset/quick-tables-double.md b/.changeset/quick-tables-double.md
new file mode 100644
index 000000000..123a03f0f
--- /dev/null
+++ b/.changeset/quick-tables-double.md
@@ -0,0 +1,5 @@
+---
+'@eth-optimism/l2geth': patch
+---
+
+Fix queue index comparison
diff --git a/l2geth/rollup/sync_service.go b/l2geth/rollup/sync_service.go
index 55d297edb..3acbc327b 100644
--- a/l2geth/rollup/sync_service.go
+++ b/l2geth/rollup/sync_service.go
@@ -348,10 +348,10 @@ func (s *SyncService) initializeLatestL1(ctcDeployHeight *big.Int) error {
 			qi := tx.GetMeta().QueueIndex
 			// When the queue index is set
 			if qi != nil {
-				if qi == queueIndex {
-					log.Info("Found correct staring queue index", "queue-index", qi)
+				if *qi == *queueIndex {
+					log.Info("Found correct staring queue index", "queue-index", *qi)
 				} else {
-					log.Info("Found incorrect staring queue index, fixing", "old", queueIndex, "new", qi)
+					log.Info("Found incorrect staring queue index, fixing", "old", *queueIndex, "new", *qi)
 					queueIndex = qi
 				}
 				break
-- 
2.23.0