summaryrefslogtreecommitdiffstats
path: root/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/api')
-rw-r--r--src/api/events.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/api/events.rs b/src/api/events.rs
index 496a077..214882a 100644
--- a/src/api/events.rs
+++ b/src/api/events.rs
@@ -124,7 +124,8 @@ async fn event(State(state): State<AppState>, Path(id): Path<String>) -> Respons
/// `GET /events/counts`: what counts, as the store reads now: the current version, each
/// party's keys and nodes, the values at places, the members, and the proposals on the
-/// current version, each with the events proposing it, the votes on it, the parties
+/// current version, each with the events proposing it a vote may build on (`proposing`:
+/// for a checkpoint, those above its heads), the votes on it, the parties
/// voting `true` and `false`, whether it passed and whether it is dead, and why a party's
/// client backs it not, where it is no version that can be written on the current one
/// (`client::backable`).
@@ -155,13 +156,21 @@ async fn counts(State(state): State<AppState>) -> Response {
.into_iter()
.map(|(hash, ballot)| {
let tally = read.tally(current, &hash);
+ let proposing = read.proposing(&current.hash, &hash);
let none = read
.proposal(&hash)
- .and_then(|proposed| client::backable(current, proposed).err());
+ .and_then(|proposed| client::backable(current, proposed).err())
+ .or_else(|| {
+ (proposing.is_empty() && !ballot.proposals.is_empty()).then(|| {
+ "no event proposing it is above the heads it names: no version \
+ event is written on a vote on it"
+ .to_owned()
+ })
+ });
(
hash.to_string(),
json!({
- "proposals": ids(ballot.proposals),
+ "proposals": ids(proposing),
"votes": ids(ballot.votes),
"yes": tally.yes,
"no": tally.no,