a couple bugfixes
This commit is contained in:
parent
c01f70105f
commit
86083531c6
@ -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())
|
||||
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user