aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation/party.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/federation/party.rs')
-rw-r--r--src/federation/party.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/federation/party.rs b/src/federation/party.rs
index bc10a10..99a95be 100644
--- a/src/federation/party.rs
+++ b/src/federation/party.rs
@@ -14,7 +14,8 @@
//! each one argument, their comments left out) or node list (node IDs);
//! * `next`: the version after the current one, to change and propose: the current one
//! numbered on, naming its hash, without its checkpoint (JSON), to standard output;
-//! * `propose FILE`: proposes the version `FILE` holds (JSON);
+//! * `propose FILE`: proposes the version `FILE` holds (JSON), where it changes the
+//! current one as a version must (`Version::changes_validly`);
//! * `vote PROPOSAL yes|no`: votes on the proposal of hash `PROPOSAL` on the current
//! version, by the record; with `--through`, through the node that votes for the
//! party by itself and keeps its record, as such a party votes by hand;
@@ -308,6 +309,12 @@ pub(crate) async fn main() -> Result<()> {
}
("propose", sub) => {
let version = version_in(sub.get_one::<String>("file").expect("required"))?;
+ let current = node.current().await?;
+ Version::read(&version)
+ .and_then(|proposed| proposed.changes_validly(Some(&current)))
+ .map_err(|why| {
+ anyhow!("not a version changing version {}: {why}", current.number)
+ })?;
sign(
&node,
&signer,