aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/config/mod.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs
index 5dae0c2..726ca12 100644
--- a/src/config/mod.rs
+++ b/src/config/mod.rs
@@ -1200,6 +1200,23 @@ impl Settings {
set.join(", ")
);
}
+ // Its parties say who syncs, and a node writes no protocol data but its own.
+ let none = [
+ ("swarm-key-file", self.swarm_key_file.is_some()),
+ ("swarm-key-create", self.swarm_key_create),
+ ("protocol-writers", !self.protocol_writers.is_empty()),
+ ];
+ let set: Vec<&str> = none
+ .iter()
+ .filter(|(_, set)| *set)
+ .map(|(name, _)| *name)
+ .collect();
+ if !set.is_empty() {
+ bail!(
+ "{store}: a swarm holding a store has no swarm key, as its parties say who syncs, and no protocol writers, as a node writes no protocol data but its own: {} don't apply",
+ set.join(", ")
+ );
+ }
Ok(())
}
@@ -2338,6 +2355,13 @@ mod tests {
.is_err()
);
assert!(checked(json!({ "store-id": id, "store-party": "tv", "genesis": true })).is_err());
+ assert!(
+ checked(json!({ "store-id": id, "store-party": "tv", "swarm-key-file": "k" })).is_err()
+ );
+ assert!(
+ checked(json!({ "store-id": id, "store-party": "tv", "protocol-writers": ["alice"] }))
+ .is_err()
+ );
}
#[test]