aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation/vote.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/federation/vote.rs')
-rw-r--r--src/federation/vote.rs37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/federation/vote.rs b/src/federation/vote.rs
index 2e5ce15..c274849 100644
--- a/src/federation/vote.rs
+++ b/src/federation/vote.rs
@@ -5,7 +5,8 @@
//! * **Following**: it votes `true` on a proposal on the current version where a party it
//! follows voted `true`, never `false`; by default only on a version that only moves to a
//! checkpoint (`Version::only_moves_on`), and then only where no proposal that changes
-//! more holds it back (`holds_back`), as such a version lapses it.
+//! more holds it back (`holds_back`), as such a version lapses it; never on one changing
+//! the revision.
//! * **Proposing a checkpoint**: once so many events are held beyond its checkpoint, so
//! many versions were written since, or so long after it moved there by its own clock, it
//! proposes a version that only moves to a checkpoint, at the heads of what it held for a
@@ -268,6 +269,15 @@ pub(crate) fn decide(seen: &Seen<'_>, rules: &Rules, record: &Record) -> Vec<Act
if !own_one && !rules.follow_any && !moves_on {
continue;
}
+ // A revision its operators move to by hand: its party's nodes run a continuum
+ // that knows it first.
+ let revised = proposed
+ .version
+ .as_ref()
+ .is_some_and(|version| version.revision != current.revision);
+ if !own_one && revised {
+ continue;
+ }
// A checkpoint lapses what else is proposed: the party it follows may not end so
// a proposal that changes more.
let lapses = all.iter().any(|other| {
@@ -622,6 +632,31 @@ mod tests {
));
}
+ /// A party the node follows backs a version moving to a later revision: a node
+ /// following on any version backs it not, as its operators move to a revision by hand.
+ #[test]
+ fn a_follower_backs_no_change_of_the_revision() {
+ let (tv, _, _, first, mut store) = three();
+ let root = store.id();
+ let mut revised = first.after(first.hash());
+ revised.revision = crate::federation::revision::Feature::MergeEvents.revision();
+ let proposal = taken(&mut store, tv.propose(&[root], &revised.json()));
+ taken(
+ &mut store,
+ tv.vote(&[proposal], first.hash(), revised.hash(), true),
+ );
+ let any = Rules {
+ follow: vec!["tv".to_owned()],
+ follow_any: true,
+ ..Rules::default()
+ };
+ let long = |_: &Id| Some(Duration::from_secs(3600));
+ let record = record(&store, "makefu");
+ assert!(decide(&seen(&store, &long), &any, &record).is_empty());
+ // By hand, it does.
+ assert!(by_hand(&seen(&store, &long), &any, &record, revised.hash(), true).is_ok());
+ }
+
/// A party the node follows backs a checkpoint while a proposal that changes more,
/// which another party backs, can still pass: the node backs it not, as it would lapse
/// that one; while nobody but its proposer backs that one, it does.