Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo committed Dec 5, 2023
1 parent c4a2f45 commit 6bf79f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions bridge-history-api/orm/batch_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions bridge-history-api/orm/cross_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 6bf79f6

Please sign in to comment.