Skip to content

Commit

Permalink
fix: height can't be higher than current latest block
Browse files Browse the repository at this point in the history
  • Loading branch information
albttx committed Feb 6, 2025
1 parent 5a2a74a commit e33a170
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/tm2-indexer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ func main() {
}).Info("Starting")

height := latestBlockHeightStored + int64(config.Scrapper.BatchWrite)
if height > latestBlock {
height = latestBlock
}

// Insert validators
validatorResp, err := rpc.RPCClient.Validators(&height)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions internal/db/schemas.sql
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ CREATE INDEX IF NOT EXISTS idx_transactions_hash ON transactions(hash
CREATE INDEX IF NOT EXISTS idx_messages_height_tx_hash ON messages(height, tx_hash);
CREATE INDEX IF NOT EXISTS idx_messages_tx_hash_index ON messages(tx_hash, index);

CREATE INDEX IF NOT EXISTS idx_block_signatures_signed_validator_addr_block_height ON block_signatures (signed, validator_addr, block_height);
CREATE INDEX IF NOT EXISTS idx_block_signatures_block_height_asc ON block_signatures (block_height ASC);

-- gave read only access to grafana user for dashboards
-- GRANT USAGE ON SCHEMA public to grafana;
-- GRANT SELECT ON ALL TABLES IN SCHEMA public TO grafana;
Expand Down

0 comments on commit e33a170

Please sign in to comment.