aboutsummaryrefslogtreecommitdiffstats
path: root/src/remake/vote.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/remake/vote.rs')
-rw-r--r--src/remake/vote.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/remake/vote.rs b/src/remake/vote.rs
index 7e678e6..ac94306 100644
--- a/src/remake/vote.rs
+++ b/src/remake/vote.rs
@@ -281,7 +281,7 @@ pub(super) async fn cast<H: Host>(host: &H) {
// Usually there is nothing to vote on: look first, without writing.
let (voter, wanted) = (me.clone(), epoch.clone());
let now = host.now_millis();
- let (due, missed, swarm) = host
+ let (due, missed, (swarm, strict)) = host
.read_doc(move |doc| {
let all = records::load_all(doc);
let register = records::load_register(doc);
@@ -304,7 +304,8 @@ pub(super) async fn cast<H: Host>(host: &H) {
.flatten()
.and_then(|swarm| swarm.as_str().map(str::to_owned))
.unwrap_or_default();
- (due, missed, swarm)
+ let strict = crate::access::policy::of(doc).strict();
+ (due, missed, (swarm, strict))
})
.await;
for id in missed {
@@ -336,6 +337,7 @@ pub(super) async fn cast<H: Host>(host: &H) {
host,
bytes.as_deref().map(Vec::as_slice),
&swarm,
+ strict,
&proposal.from_epoch,
proposal.base_heads.as_deref(),
)
@@ -381,15 +383,22 @@ pub(super) async fn cast<H: Host>(host: &H) {
}
/// Whether this node takes a strict remake's manifest (`content`, for `swarm`): signed
-/// by one of its `--strict-keys`, for the remake's epoch and base (`epoch`, `base`). Why
-/// not, if not.
+/// by one of its `--strict-keys`, for the remake's epoch and base (`epoch`, `base`), in
+/// a swarm not strict yet (`strict`: once it is, its registry, policy and bans change by
+/// their users' signatures, not by a majority of members). Why not, if not.
pub(super) fn strict_taken<H: Host>(
host: &H,
content: Option<&[u8]>,
swarm: &str,
+ strict: bool,
epoch: &EpochRecord,
base: Option<&[String]>,
) -> Result<(), String> {
+ if strict {
+ return Err(
+ "the swarm is strict already: its registry changes by its users' signatures".to_owned(),
+ );
+ }
let text = content
.and_then(|bytes| std::str::from_utf8(bytes).ok())
.ok_or("no manifest")?;