Function solana_ledger::blockstore::handle_chaining_for_slot
source · fn handle_chaining_for_slot(
db: &Database,
write_batch: &mut WriteBatch<'_>,
working_set: &HashMap<u64, SlotMetaWorkingSetEntry>,
new_chained_slots: &mut HashMap<u64, Rc<RefCell<SlotMeta>>>,
slot: Slot
) -> Result<()>
Expand description
A helper function of handle_chaining which handles the chaining based
on the SlotMetaWorkingSetEntry
of the specified slot
. Specifically,
it handles the following two things:
- based on the
SlotMetaWorkingSetEntry
forslot
, check ifslot
did not previously have a parent slot but does now. Ifslot
satisfies this condition, update the Orphan property of bothslot
and its parent slot based on their current orphan status. Specifically:
- updates the orphan property of slot to no longer be an orphan because it has a parent.
- adds the parent to the orphan column family if the parent’s parent is currently unknown.
- if the
SlotMetaWorkingSetEntry
forslot
indicates this slot is newly connected to a parent slot, then this function will update the is_connected property of all its direct and indirect children slots.
This function may update column family cf::Orphans
and indirectly
update SlotMeta from its output parameter new_chained_slots
.
Arguments:
db
: the underlying db for blockstore
write_batch
: the write batch which includes all the updates of the
the current write and ensures their atomicity.
working_set
: the working set which include the specified slot
new_chained_slots
: an output parameter which includes all the slots
which connectivity have been updated.
slot
: the slot which we want to handle its chaining effect.