Skip to content

Commit

Permalink
skip undo gen in reproc mod
Browse files Browse the repository at this point in the history
  • Loading branch information
billettc committed Feb 8, 2024
1 parent c1b9ce0 commit 2fd544e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,15 @@ func (db *OperationDB) Flush(ctx context.Context, cursor *sink.Cursor) (count in
}

func (db *OperationDB) HandleOperations(ctx context.Context, blockNumber, finalBlockHeight uint64, kvOps *pbkv.KVOperations) error {
err := db.DeleteLIBUndoOperations(ctx, finalBlockHeight)
if err != nil {
return fmt.Errorf("deleting LIB undo operations: %w", err)
}

err = db.storeUndoOperations(ctx, blockNumber, kvOps.Operations)
if err != nil {
return fmt.Errorf("storing reverse operations: %w", err)
if blockNumber >= finalBlockHeight {
err := db.DeleteLIBUndoOperations(ctx, finalBlockHeight)
if err != nil {
return fmt.Errorf("deleting LIB undo operations: %w", err)
}
err = db.storeUndoOperations(ctx, blockNumber, kvOps.Operations)
if err != nil {
return fmt.Errorf("storing reverse operations: %w", err)
}
}

db.AddOperations(kvOps)
Expand Down

0 comments on commit 2fd544e

Please sign in to comment.