diff --git a/chain/events/filter/index.go b/chain/events/filter/index.go index 4d7de5185f4..aacd04f15c0 100644 --- a/chain/events/filter/index.go +++ b/chain/events/filter/index.go @@ -97,7 +97,7 @@ const ( restoreEvent = `UPDATE event SET reverted=false WHERE height=? AND tipset_key=? AND tipset_key_cid=? AND emitter_addr=? AND event_index=? AND message_cid=? AND message_index=?` revertEventSeen = `UPDATE events_seen SET reverted=true WHERE height=? AND tipset_key_cid=?` restoreEventSeen = `UPDATE events_seen SET reverted=false WHERE height=? AND tipset_key_cid=?` - upsertEventsSeen = `INSERT INTO events_seen(height, tipset_key_cid, reverted) VALUES(?, ?, ?) ON CONFLICT(height, tipset_key_cid) DO UPDATE SET reverted=false` + upsertEventsSeen = `INSERT INTO events_seen(height, tipset_key_cid, reverted) VALUES(?, ?, false) ON CONFLICT(height, tipset_key_cid) DO UPDATE SET reverted=false` isTipsetProcessed = `SELECT COUNT(*) > 0 FROM events_seen WHERE tipset_key_cid=?` getMaxHeightInIndex = `SELECT MAX(height) FROM events_seen` isHeightProcessed = `SELECT COUNT(*) > 0 FROM events_seen WHERE height=?` @@ -867,7 +867,6 @@ func (ei *EventIndex) CollectEvents(ctx context.Context, te *TipSetEvents, rever _, err = tx.Stmt(ei.stmtUpsertEventsSeen).Exec( te.msgTs.Height(), tsKeyCid.Bytes(), - false, ) if err != nil { return xerrors.Errorf("exec upsert events seen: %w", err) diff --git a/node/impl/full/eth.go b/node/impl/full/eth.go index 3cbffe84a2d..26eb1b72562 100644 --- a/node/impl/full/eth.go +++ b/node/impl/full/eth.go @@ -1278,7 +1278,7 @@ func (e *EthEventHandler) EthGetLogs(ctx context.Context, filterSpec *ethtypes.E maxHeight = e.Chain.GetHeaviestTipSet().Height() } if maxHeight > e.Chain.GetHeaviestTipSet().Height() { - return nil, xerrors.Errorf("max height requested is greater than the heaviest tipset") + return nil, xerrors.Errorf("maxHeight requested is greater than the heaviest tipset") } err := e.waitForHeightProcessed(ctx, maxHeight) @@ -1289,7 +1289,7 @@ func (e *EthEventHandler) EthGetLogs(ctx context.Context, filterSpec *ethtypes.E // should also have the minHeight in the filter indexed b, err := e.EventFilterManager.EventIndex.IsHeightProcessed(ctx, uint64(pf.minHeight)) if err != nil { - return nil, xerrors.Errorf("failed to check if event index has events for the minheight: %w", err) + return nil, xerrors.Errorf("failed to check if event index has events for the minHeight: %w", err) } if !b { return nil, xerrors.Errorf("event index does not have event for epoch %d", pf.minHeight) @@ -1335,11 +1335,9 @@ func (e *EthEventHandler) waitForHeightProcessed(ctx context.Context, height abi defer cancel() // if the height we're interested in has already been indexed -> there's nothing to do here - b, err := ei.IsHeightProcessed(ctx, uint64(height)) - if err != nil { + if b, err := ei.IsHeightProcessed(ctx, uint64(height)); err != nil { return xerrors.Errorf("failed to check if event index has events for given height: %w", err) - } - if b { + } else if b { return nil }