aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-18 11:51:01 +0000
committertv <tv@krebsco.de>2026-11-18 13:06:12 +0100
commitacfbdf87dd346137b05f8b28d54068de1c77e0c2 (patch)
treef032122454b2c23c4369c4bd3b0d5434933b3057 /src
parent1c0ad4202d971a3555157c2babc07999d166959d (diff)
continuum-party propose: only a version changing the current one
The client proposes a version only where it changes the current one as a version must (its number, the hash it names, each `since`), and says why it doesn't otherwise: no other can pass.
Diffstat (limited to 'src')
-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,