Skip to content

Commit

Permalink
fix(splitstore): fix a panic on revert-only head changes
Browse files Browse the repository at this point in the history
Calling, e.g., `lotus chain sethead` on an ancestor tipset won't apply
any new blocks, it'll just revert a bunch. This will lead to HeadChange
calls with no new blocks to apply.

fixes #6125
  • Loading branch information
Stebalien committed Apr 29, 2021
1 parent 4688da5 commit 8115816
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions blockstore/splitstore/splitstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,11 @@ func (s *SplitStore) Close() error {
}

func (s *SplitStore) HeadChange(_, apply []*types.TipSet) error {
// Revert only.
if len(apply) == 0 {
return nil
}

s.mx.Lock()
curTs := apply[len(apply)-1]
epoch := curTs.Height()
Expand Down

0 comments on commit 8115816

Please sign in to comment.