Fix edgecase in tipset skipcache

This commit is contained in:
Aayush Rajasekaran 2021-05-27 13:42:42 -04:00
parent 21b4741e30
commit 10b931312b
2 changed files with 6 additions and 0 deletions

View File

@ -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 {

View File

@ -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)
@ -942,4 +943,6 @@ func TestDrandNull(t *testing.T) {
require.NoError(t, err)
require.Equal(t, []byte(rand), expectedRand)
build.UpgradeHyperdriveHeight = ov5h
}