Skip to content

Commit

Permalink
Fix edgecase in tipset skipcache
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed May 27, 2021
1 parent 21b4741 commit 10b9313
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions chain/store/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ func (ci *ChainIndex) fillCache(tsk types.TipSetKey) (*lbEntry, error) {
}

rheight -= ci.skipLength
if rheight < 0 {
rheight = 0
}

var skipTarget *types.TipSet
if parent.Height() < rheight {
Expand Down
3 changes: 3 additions & 0 deletions chain/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,7 @@ func TestSyncCheckpointEarlierThanHead(t *testing.T) {
func TestDrandNull(t *testing.T) {
H := 10
v5h := abi.ChainEpoch(50)
ov5h := build.UpgradeHyperdriveHeight
build.UpgradeHyperdriveHeight = v5h
tu := prepSyncTestWithV5Height(t, H, v5h)

Expand Down Expand Up @@ -942,4 +943,6 @@ func TestDrandNull(t *testing.T) {
require.NoError(t, err)

require.Equal(t, []byte(rand), expectedRand)
build.UpgradeHyperdriveHeight = ov5h

}

0 comments on commit 10b9313

Please sign in to comment.