Skip to content

Commit

Permalink
ChainData: always read account from the newest slot, whatever the slo…
Browse files Browse the repository at this point in the history
…t status
  • Loading branch information
farnyser committed Aug 14, 2024
1 parent 5c69dca commit ae9c891
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions connector/src/chain_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,16 +232,17 @@ impl ChainData {
}

fn is_account_write_live(&self, write: &AccountData) -> bool {
self.slots
.get(&write.slot)
// either the slot is rooted or in the current chain
.map(|s| {
s.status == SlotStatus::Rooted
|| s.chain == self.best_chain_slot
|| write.slot > self.best_chain_slot
})
// if the slot can't be found but preceeds newest rooted, use it too (old rooted slots are removed)
.unwrap_or(write.slot <= self.newest_rooted_slot || write.slot > self.best_chain_slot)
// self.slots
// .get(&write.slot)
// // either the slot is rooted or in the current chain
// .map(|s| {
// s.status == SlotStatus::Rooted
// || s.chain == self.best_chain_slot
// || write.slot > self.best_chain_slot
// })
// // if the slot can't be found but preceeds newest rooted, use it too (old rooted slots are removed)
// .unwrap_or(write.slot <= self.newest_rooted_slot || write.slot > self.best_chain_slot)
true
}

fn newest_rooted_write<'a>(
Expand Down

0 comments on commit ae9c891

Please sign in to comment.