Merge pull request #10878 from filecoin-project/sbansal/neg-epoch-check

Check if epoch is negative in GetTipsetByHeight
This commit is contained in:
Łukasz Magiera 2023-05-17 11:07:14 +02:00 committed by GitHub
commit aaa376c5e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1161,6 +1161,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
// the null round if false.
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 {
ts = cs.GetHeaviestTipSet()
}