From 47a1ba1a2cb8ad18a6271bbe380eb32da3d56024 Mon Sep 17 00:00:00 2001 From: Josef Date: Fri, 26 Jul 2024 07:38:46 +0200 Subject: [PATCH] fix: don't crash pindexer on blocks without a timestamp (#4764) ## Describe your changes this sets timestamp to default for blocks without one to ## Issue ticket number and link fixes https://github.com/penumbra-zone/penumbra/issues/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 --- crates/bin/pindexer/src/block.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/bin/pindexer/src/block.rs b/crates/bin/pindexer/src/block.rs index 21ee69dc79..62ff294a35 100644 --- a/crates/bin/pindexer/src/block.rs +++ b/crates/bin/pindexer/src/block.rs @@ -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( "