a couple bugfixes

This commit is contained in:
whyrusleeping 2020-06-03 18:25:41 -07:00 committed by Aayush Rajasekaran
parent c01f70105f
commit 86083531c6
2 changed files with 9 additions and 2 deletions

View File

@ -58,7 +58,7 @@ func (ci *ChainIndex) GetTipsetByHeight(ctx context.Context, from *types.TipSet,
if lbe.ts.Height() == to || lbe.parentHeight < to {
return lbe.ts, nil
} else if to > lbe.ts.Height()-ci.skipLength {
return ci.walkBack(from, to)
return ci.walkBack(lbe.ts, to)
}
cur = lbe.target
@ -71,6 +71,13 @@ func (ci *ChainIndex) fillCache(tsk types.TipSetKey) (*lbEntry, error) {
return nil, err
}
if ts.Height() == 0 {
return &lbEntry{
ts: ts,
parentHeight: 0,
}, nil
}
// will either be equal to ts.Height, or at least > ts.Parent.Height()
rheight := ci.roundHeight(ts.Height())

View File

@ -946,7 +946,7 @@ func (cs *ChainStore) GetTipsetByHeight(ctx context.Context, h abi.ChainEpoch, t
}
if h > ts.Height() {
return nil, xerrors.Errorf("looking for tipset with height less than start point")
return nil, xerrors.Errorf("looking for tipset with height greater than start point")
}
if h == ts.Height() {