Merge pull request #10918 from filecoin-project/asr/backport
Check if epoch is negative in GetTipsetByHeight
This commit is contained in:
commit
9900dbe1de
@ -1156,6 +1156,10 @@ func (cs *ChainStore) TryFillTipSet(ctx context.Context, ts *types.TipSet) (*Ful
|
|||||||
// selects the tipset before the null round if true, and the tipset following
|
// selects the tipset before the null round if true, and the tipset following
|
||||||
// the null round if false.
|
// the null round if false.
|
||||||
func (cs *ChainStore) GetTipsetByHeight(ctx context.Context, h abi.ChainEpoch, ts *types.TipSet, prev bool) (*types.TipSet, error) {
|
func (cs *ChainStore) GetTipsetByHeight(ctx context.Context, h abi.ChainEpoch, ts *types.TipSet, prev bool) (*types.TipSet, error) {
|
||||||
|
if h < 0 {
|
||||||
|
return nil, xerrors.Errorf("height %d is negative", h)
|
||||||
|
}
|
||||||
|
|
||||||
if ts == nil {
|
if ts == nil {
|
||||||
ts = cs.GetHeaviestTipSet()
|
ts = cs.GetHeaviestTipSet()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user