Skip to content

Commit

Permalink
fix(events): get currentHeight from chainstore if we don't have it
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Apr 26, 2024
1 parent 59b166b commit 74c926c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions chain/events/filter/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,13 @@ func (m *EventFilterManager) Revert(ctx context.Context, from, to *types.TipSet)
func (m *EventFilterManager) Install(ctx context.Context, minHeight, maxHeight abi.ChainEpoch, tipsetCid cid.Cid, addresses []address.Address,
keysWithCodec map[string][]types.ActorEventBlock, excludeReverted bool) (EventFilter, error) {
m.mu.Lock()
if m.currentHeight == 0 {
// sync in progress, we haven't had an Apply
m.currentHeight = m.ChainStore.GetHeaviestTipSet().Height()
}
currentHeight := m.currentHeight
m.mu.Unlock()

if currentHeight == 0 {
return nil, xerrors.Errorf("sync in progress, cannot install event filter")
}

if m.EventIndex == nil && minHeight != -1 && minHeight < currentHeight {
return nil, xerrors.Errorf("historic event index disabled")
}
Expand Down

0 comments on commit 74c926c

Please sign in to comment.