diff options
| author | tv <tv@krebsco.de> | 2026-11-17 02:49:55 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-17 03:50:22 +0100 |
| commit | 55a62cbeb66a640c8d9eff07b0ac441ef2d9859c (patch) | |
| tree | 6dffc790f9dc1131d6fd124df7c3c6f02b0eafa3 /src/federation/party.rs | |
| parent | 233a48fffdd42f6700b71a45b87e89c337bdd648 (diff) | |
federation: votes build on the events proposing what they vote on
A node voting by itself, and a party's client, signed a vote on the heads
the node held: where those held what is beside a checkpoint's heads (a
party's writes made while the swarm was parted, say), the vote wasn't above
them, and a version event written on it was refused, so the checkpoint
never moved, though it passed. Both now vote on the events proposing what
they vote on, and a node proposes a checkpoint on the heads it names: so
their votes are above those heads wherever the proposal is.
Diffstat (limited to 'src/federation/party.rs')
| -rw-r--r-- | src/federation/party.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/federation/party.rs b/src/federation/party.rs index d7880c2..ecd75a9 100644 --- a/src/federation/party.rs +++ b/src/federation/party.rs @@ -364,7 +364,8 @@ async fn vote( .filter_map(|id| id.as_str().and_then(Id::from_hex)) .collect() }; - let Some(proposing) = ids(&proposal, "proposals").first().copied() else { + let proposals = ids(&proposal, "proposals"); + let Some(proposing) = proposals.first().copied() else { bail!("no proposal of hash {proposal} on the current version, as the node reads it"); }; let proposed = match Event::read(&node.event(&proposing).await?) { @@ -400,8 +401,9 @@ async fn vote( let kept = record .may_vote(¤t, proposal, &proposed, yes, &nays) .map_err(|why| anyhow!(why))?; - let (_, heads) = node.summary().await?; - let cast = signer.sign(&heads, event::vote(current.hash, proposal, yes)); + // On the events proposing it: above the heads it names for a checkpoint wherever they + // are, so a version event may be written on it. + let cast = signer.sign(&proposals, event::vote(current.hash, proposal, yes)); record.cast(¤t, &cast, kept); record.save(path).map_err(|why| anyhow!(why))?; node.put(&cast).await |
