diff options
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/events.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/api/events.rs b/src/api/events.rs index 5a69769..1d275f9 100644 --- a/src/api/events.rs +++ b/src/api/events.rs @@ -199,7 +199,8 @@ async fn heard(state: &AppState) -> std::collections::HashMap<String, u64> { /// 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, why a party's /// client backs it not, where it is no version that can be written on the current one -/// (`client::backable`), and, for a checkpoint, what its parties signed that moving there +/// (`client::backable`) or names heads no version may (`State::may_name`), and, for a +/// checkpoint, what its parties signed that moving there /// refuses (`beside`, `signed_beside`). async fn counts(State(state): State<AppState>) -> Response { let aliases = crate::swarm::members::aliases(&state.doc.read().await.doc); @@ -256,6 +257,17 @@ async fn counts(State(state): State<AppState>) -> Response { .proposal(&hash) .and_then(|proposed| client::backable(current, proposed).err()) .or_else(|| { + let heads = read + .proposal(&hash) + .and_then(|json| crate::federation::version::Version::read(json).ok()) + .and_then(|version| version.checkpoint)?; + let why = read.may_name(&heads).err()?; + Some(format!( + "no version event may name its heads ({}): it is never written", + why.0 + )) + }) + .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" |
