Skip to content

Commit a6e731f

Browse files
authored
v1.18: blockstore: relax parent slot meta check for clear_unconfirmed_slot (#68)
blockstore: relax parent slot meta check for clear_unconfirmed_slot
1 parent d4678fc commit a6e731f

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

ledger/src/blockstore.rs

+17-10
Original file line numberDiff line numberDiff line change
@@ -1179,18 +1179,25 @@ impl Blockstore {
11791179

11801180
// Clear this slot as a next slot from parent
11811181
if let Some(parent_slot) = slot_meta.parent_slot {
1182-
let mut parent_slot_meta = self
1182+
if let Some(mut parent_slot_meta) = self
11831183
.meta(parent_slot)
11841184
.expect("Couldn't fetch from SlotMeta column family")
1185-
.expect("Unconfirmed slot should have had parent slot set");
1186-
// .retain() is a linear scan; however, next_slots should
1187-
// only contain several elements so this isn't so bad
1188-
parent_slot_meta
1189-
.next_slots
1190-
.retain(|&next_slot| next_slot != slot);
1191-
self.meta_cf
1192-
.put(parent_slot, &parent_slot_meta)
1193-
.expect("Couldn't insert into SlotMeta column family");
1185+
{
1186+
// .retain() is a linear scan; however, next_slots should
1187+
// only contain several elements so this isn't so bad
1188+
parent_slot_meta
1189+
.next_slots
1190+
.retain(|&next_slot| next_slot != slot);
1191+
self.meta_cf
1192+
.put(parent_slot, &parent_slot_meta)
1193+
.expect("Couldn't insert into SlotMeta column family");
1194+
} else {
1195+
error!(
1196+
"Parent slot meta {} for child {} is missing or cleaned up.
1197+
Falling back to orphan repair to remedy the situation",
1198+
parent_slot, slot
1199+
);
1200+
}
11941201
}
11951202
// Reinsert parts of `slot_meta` that are important to retain, like the `next_slots`
11961203
// field.

0 commit comments

Comments
 (0)