Skip to content

Commit

Permalink
subscriber: fix index
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjan committed Apr 17, 2024
1 parent bf0cf3b commit 0923817
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions chain/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,8 @@ func (s *Subscriber) processUpdates(crus []chain.RevertUpdate, caus []chain.Appl
return types.ChainIndex{}, fmt.Errorf("failed to apply chain updates: %w", err)
}

// get the last index
if len(caus) > 0 {
index = caus[len(caus)-1].State.Index
} else if len(crus) > 0 {
index = crus[len(crus)-1].State.Index
}

// update chain index
index = caus[len(caus)-1].State.Index
if err := tx.UpdateChainIndex(index); err != nil {
return types.ChainIndex{}, fmt.Errorf("failed to update chain index: %w", err)
}
Expand Down

0 comments on commit 0923817

Please sign in to comment.