diff options
Diffstat (limited to 'src/api/events.rs')
| -rw-r--r-- | src/api/events.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/api/events.rs b/src/api/events.rs index 06a6e31..81f1481 100644 --- a/src/api/events.rs +++ b/src/api/events.rs @@ -155,7 +155,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, what each of those nodes says it speaks and knows (`knows`), +/// party's keys and nodes, the names those nodes gave themselves (`names`, `--alias`), what +/// each of them says it speaks and knows (`knows`), /// the values at places, the members, and the proposals on the /// current version, each with the events proposing it a vote may build on (`proposals`: /// for a checkpoint, those above its heads), the votes on it, the parties @@ -164,6 +165,7 @@ async fn event(State(state): State<AppState>, Path(id): Path<String>) -> Respons /// (`client::backable`), 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); with_store(&state, |store| { let read = store.state(); let current = read.current(); @@ -176,11 +178,16 @@ async fn counts(State(state): State<AppState>) -> Response { .iter() .map(|node| (node.clone(), knows(&state, node))) .collect(); + let names: serde_json::Map<String, JsonValue> = nodes + .iter() + .filter_map(|node| Some((node.clone(), aliases.get(node)?.clone().into()))) + .collect(); ( party.clone(), json!({ "keys": read.keys_of(party, current), "nodes": nodes, + "names": names, "knows": knows, }), ) |
