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.rs20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/federation/party.rs b/src/federation/party.rs
index f64746b..a544155 100644
--- a/src/federation/party.rs
+++ b/src/federation/party.rs
@@ -836,9 +836,23 @@ async fn vote(
eprintln!("Warning: {why}");
}
}
- // On the events proposing it the node shows, those above the heads it names for a
- // checkpoint, so a version event may be written on it.
- let cast = signer.sign(&proposals, event::vote(current.hash, proposal, yes))?;
+ // On an event proposing it the node shows, of a checkpoint one above the heads it
+ // names, and on the nays that freed the party (`client::building`).
+ let checkpoint = Version::read(&proposed)
+ .ok()
+ .and_then(|version| version.checkpoint)
+ .is_some();
+ if checkpoint && yes && !kept.is_empty() {
+ eprintln!(
+ "Warning: this `true` builds on {proposing} alone, not on the nays that freed \
+ {party}: where they came after the heads it names, and {party}'s `true` they \
+ ended is in the history of {proposing}, nodes refuse it; a checkpoint proposed \
+ after them takes {party}'s `true`",
+ party = signer.party
+ );
+ }
+ let on = client::building(proposing, checkpoint, &kept).map_err(|why| anyhow!(why))?;
+ let cast = signer.sign(&on, event::vote(current.hash, proposal, yes))?;
record.cast(&current, &cast, kept);
record.save(path).map_err(|why| anyhow!(why))?;
node.put(&cast).await