diff --git a/internal/state/indexer/block/kv/kv.go b/internal/state/indexer/block/kv/kv.go index 3bf64e7d7..89b8924c7 100644 --- a/internal/state/indexer/block/kv/kv.go +++ b/internal/state/indexer/block/kv/kv.go @@ -65,7 +65,7 @@ func (idx *BlockerIndexer) Index(bh types.EventDataNewBlockHeader) error { } // 2. index FinalizeBlock events - if err := idx.indexEvents(batch, bh.ResultFinalizeBlock.BlockEvents, "finalize_block", height); err != nil { + if err := idx.indexEvents(batch, bh.ResultFinalizeBlock.BlockEvents, types.EventTypeFinalizeBlock, height); err != nil { return fmt.Errorf("failed to index FinalizeBlock events: %w", err) } diff --git a/internal/state/indexer/sink/psql/psql_test.go b/internal/state/indexer/sink/psql/psql_test.go index 5d44e2d25..035b3925c 100644 --- a/internal/state/indexer/sink/psql/psql_test.go +++ b/internal/state/indexer/sink/psql/psql_test.go @@ -314,20 +314,11 @@ SELECT height FROM `+tableBlocks+` WHERE height = $1; if err := testDB().QueryRow(` SELECT type, height, chain_id FROM `+viewBlockEvents+` WHERE height = $1 AND type = $2 AND chain_id = $3; -`, height, types.EventTypeBeginBlock, chainID).Err(); err == sql.ErrNoRows { - t.Errorf("No %q event found for height=%d", types.EventTypeBeginBlock, height) +`, height, types.EventTypeFinalizeBlock, chainID).Scan(&[]byte{}); err == sql.ErrNoRows { + t.Errorf("No %q event found for height=%d", types.EventTypeFinalizeBlock, height) } else if err != nil { t.Fatalf("Database query failed: %c", err) } - - if err := testDB().QueryRow(` -SELECT type, height, chain_id FROM `+viewBlockEvents+` - WHERE height = $1 AND type = $2 AND chain_id = $3; -`, height, types.EventTypeEndBlock, chainID).Err(); err == sql.ErrNoRows { - t.Errorf("No %q event found for height=%d", types.EventTypeEndBlock, height) - } else if err != nil { - t.Fatalf("Database query failed: %v", err) - } } // verifyNotImplemented calls f and verifies that it returns both a diff --git a/types/events.go b/types/events.go index e16c8f241..3006e0d89 100644 --- a/types/events.go +++ b/types/events.go @@ -272,6 +272,9 @@ const ( // BlockHeightKey is a reserved key used for indexing FinalizeBlock events. BlockHeightKey = "block.height" + + // is a reserved key used for indexing FinalizeBlock events. + EventTypeFinalizeBlock = "finalize_block" ) var (