Skip to content

Commit a1b45e6

Browse files
dapplionmichaelsproul
authored andcommitted
Persist states even if in cache
1 parent a928d30 commit a1b45e6

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

beacon_node/store/src/hot_cold_store.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1521,7 +1521,20 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
15211521
)? {
15221522
debug!(
15231523
self.log,
1524-
"Skipping storage of cached state";
1524+
"State already exists in state cache";
1525+
"slot" => state.slot(),
1526+
"state_root" => ?state_root
1527+
);
1528+
// Write the state anyway. Testing of this branch shows that states may exist in the
1529+
// cache but not be yet ever stored in the DB
1530+
}
1531+
1532+
// TODO(hdiff): is this optimization necessary? Computing diffs is expensive so we may want
1533+
// to avoid it.
1534+
if self.load_hot_state_summary(state_root)?.is_some() {
1535+
debug!(
1536+
self.log,
1537+
"Skipping storage of state already in the db";
15251538
"slot" => state.slot(),
15261539
"state_root" => ?state_root
15271540
);

0 commit comments

Comments
 (0)