From 28d73b643c40aabace4f06efab843885b1cfe141 Mon Sep 17 00:00:00 2001 From: renancloudwalk Date: Fri, 23 Feb 2024 08:57:01 -0300 Subject: [PATCH] fix: makes postgres behave just like in memory, bypassing blocks without slots --- src/eth/storage/postgres/postgres.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/eth/storage/postgres/postgres.rs b/src/eth/storage/postgres/postgres.rs index 8144e134f..f379102a9 100644 --- a/src/eth/storage/postgres/postgres.rs +++ b/src/eth/storage/postgres/postgres.rs @@ -613,7 +613,13 @@ impl PermanentStorage for Postgres { for (slot_idx, value) in change.slots { let (original_value, val) = value.clone().take_both(); let idx: [u8; 32] = slot_idx.into(); - let val: [u8; 32] = val.ok_or(anyhow::anyhow!("critical: no change for slot"))?.value.into(); // the or condition should never happen + let val: [u8; 32] = match val { + Some(s) => s.value.into(), + None => { + tracing::trace!("slot value not set, skipping"); + break; + } + }; let block_number = i64::try_from(block.header.number).context("failed to convert block number")?; let original_value: [u8; 32] = original_value.unwrap_or_default().value.into();