diff --git a/bridge-history-api/orm/batch_event.go b/bridge-history-api/orm/batch_event.go index c75fc4bb98..baf42e342e 100644 --- a/bridge-history-api/orm/batch_event.go +++ b/bridge-history-api/orm/batch_event.go @@ -63,11 +63,15 @@ func (c *BatchEvent) InsertOrUpdateBatchEvents(ctx context.Context, l1BatchEvent return fmt.Errorf("failed to insert batch event, batch: %+v, error: %w", l1BatchEvent, err) } case BatchStatusTypeFinalized: + db = db.Where("batch_index = ?", l1BatchEvent.BatchIndex) + db = db.Where("batch_hash = ?", l1BatchEvent.BatchHash) updateFields["batch_status"] = BatchStatusTypeFinalized if err := db.Updates(updateFields).Error; err != nil { return fmt.Errorf("failed to update batch event, batch: %+v, error: %w", l1BatchEvent, err) } case BatchStatusTypeReverted: + db = db.Where("batch_index = ?", l1BatchEvent.BatchIndex) + db = db.Where("batch_hash = ?", l1BatchEvent.BatchHash) updateFields["batch_status"] = BatchStatusTypeReverted if err := db.Updates(updateFields).Error; err != nil { return fmt.Errorf("failed to update batch event, batch: %+v, error: %w", l1BatchEvent, err) diff --git a/bridge-history-api/orm/cross_message.go b/bridge-history-api/orm/cross_message.go index f341fa9954..16bf14412d 100644 --- a/bridge-history-api/orm/cross_message.go +++ b/bridge-history-api/orm/cross_message.go @@ -51,9 +51,8 @@ type RollupStatusType int // Constants for RollupStatusType. const ( - RollupStatusTypeUncommitted RollupStatusType = iota - RollupStatusTypeCommitted - RollupStatusTypeFinalized // only batch finalized status is used. + RollupStatusTypeUnknown RollupStatusType = iota + RollupStatusTypeFinalized // only batch finalized status is used. ) // MessageQueueEventType represents the type of message queue event.