From b0d1385273557e1842474adc445a253ece959286 Mon Sep 17 00:00:00 2001 From: Shrenuj Bansal Date: Tue, 16 May 2023 21:19:03 -0400 Subject: [PATCH] Check if epoch is negative in GetTipsetByHeight --- chain/store/store.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chain/store/store.go b/chain/store/store.go index fd12b88a53..88103ac48b 100644 --- a/chain/store/store.go +++ b/chain/store/store.go @@ -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() }