Skip to content

Commit

Permalink
fix: don't crash pindexer on blocks without a timestamp (#4764)
Browse files Browse the repository at this point in the history
## Describe your changes

this sets timestamp to default for blocks without one to

## Issue ticket number and link

fixes #4761

## Checklist before requesting a review

- [x] If this code contains consensus-breaking changes, I have added the
"consensus-breaking" label. Otherwise, I declare my belief that there
are not consensus-breaking changes, for the following reason:

indexer changes only
  • Loading branch information
vacekj authored Jul 26, 2024
1 parent 5115818 commit 47a1ba1
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions crates/bin/pindexer/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ CREATE TABLE IF NOT EXISTS block_details (
_src_db: &PgPool,
) -> Result<(), anyhow::Error> {
let pe = pb::EventBlockRoot::from_event(event.as_ref())?;
let timestamp = pe
.timestamp
.ok_or(anyhow!("block at height {} has no timestamp", pe.height))?;
let timestamp = pe.timestamp.unwrap_or_default();

sqlx::query(
"
Expand Down

0 comments on commit 47a1ba1

Please sign in to comment.