From 98d41043fa16adf59e6ef84957f33c504ff42d69 Mon Sep 17 00:00:00 2001 From: Lou-Kamades Date: Mon, 22 Jan 2024 09:36:09 -0600 Subject: [PATCH] update Chaindata.update_slot comment --- connector/src/chain_data.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/connector/src/chain_data.rs b/connector/src/chain_data.rs index 8e1e6fa..4532d9c 100644 --- a/connector/src/chain_data.rs +++ b/connector/src/chain_data.rs @@ -71,8 +71,9 @@ impl Default for ChainData { } impl ChainData { - /// Updates the ChainData with the provided slot - /// Returns a tuple of expired slots and slots that are not on the best chain + /// Updates the ChainData with the provided slot. + /// Returns a tuple of expired slots and slots that are not on the best chain. The returned slots are NOT ordered. + /// Expired slots are older than the newest rooted slot and are not retained in the ChainData. pub fn update_slot(&mut self, new_slot: SlotData) -> (Vec, Vec) { let new_processed_head = new_slot.slot > self.newest_processed_slot; if new_processed_head { @@ -157,7 +158,7 @@ impl ChainData { // now it's fine to drop any slots before the new rooted head // as account writes for non-rooted slots before it have been dropped // also check for slots that are not on the best chain - for (slot, data) in self.slots.iter_mut() { + for (slot, data) in self.slots.iter() { if *slot < self.newest_rooted_slot { expired_slots.push(*slot); } else if data.chain != self.best_chain_slot {