From 169b6b0e573ecc2a3f8e5f78d54f2e5c484a1373 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 16 Nov 2026 16:23:51 +0000 Subject: store: moving to a checkpoint, and starting from a pinned one Once the fold names heads of a later checkpoint (events after the store's, none in another's history), the store builds the checkpoint at them, keeps what the fold keeps, forgets what came before them, and refuses every event not above them, with what waits on such an event. What it forgot is held as accounted for: brought again, it is held, and an event built on it isn't above the heads. A store starts from a checkpoint its operator pins, its events building on the heads the checkpoint was built at. A node starting from a checkpoint must judge the event that named it as every node does; the fold for the tests counts the heads of the checkpoint a state starts from as after the checkpoint current at them, so that it does. --- src/federation/store/testfold.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/federation/store/testfold.rs') diff --git a/src/federation/store/testfold.rs b/src/federation/store/testfold.rs index 4b7e1b2..68397e7 100644 --- a/src/federation/store/testfold.rs +++ b/src/federation/store/testfold.rs @@ -176,7 +176,12 @@ impl State { /// Whether `heads` may be a checkpoint's here, and the state is above them. fn above(&self, heads: &[Id]) -> bool { - let after = |id: &Id| self.graph.contains_key(id) && !self.before.contains(id); + // The heads of the checkpoint the state starts from count as after the checkpoint + // current at them, so that a node starting from it judges the cut naming it as + // every node does. + let after = |id: &Id| { + (self.graph.contains_key(id) && !self.before.contains(id)) || self.at.contains(id) + }; if heads.is_empty() || !heads.iter().all(after) { return false; } -- cgit v1.3.1