aboutsummaryrefslogtreecommitdiffstats
path: root/src/federation
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-19 22:03:28 +0000
committertv <tv@krebsco.de>2026-11-19 23:04:37 +0100
commit10786d2e598865cd6e763df08f692cfc0f756908 (patch)
treeab0cced77b660ef2f789d68ed77cefb122ae6fdc /src/federation
parent4c2a4dfdb88fb008e0ba915047207efb8418ce77 (diff)
continuum-party status: this node by its ID, not by being heard 0 s agoHEADmaster
`status` took a node heard from 0 seconds ago for the node it asked, as counts give 0 for that one; another node heard from within the second was called `this node` too. GET /events says the node's ID now (`node`), and `status` marks the node of that ID (`here` in --json), and no other, as `this node`; another heard from within the second is `heard 0 s ago`.
Diffstat (limited to 'src/federation')
-rw-r--r--src/federation/party/status.rs32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/federation/party/status.rs b/src/federation/party/status.rs
index 2428845..4c637fa 100644
--- a/src/federation/party/status.rs
+++ b/src/federation/party/status.rs
@@ -66,6 +66,7 @@ async fn model(node: &Node, options: &Options, party: Option<&str>) -> Result<Js
json!({
"id": id,
"name": of["names"][id],
+ "here": summary["node"].as_str() == Some(id.as_str()),
"heard": of["heard"][id],
"knows": of["knows"][id],
})
@@ -112,6 +113,7 @@ async fn model(node: &Node, options: &Options, party: Option<&str>) -> Result<Js
"stopped": summary["stopped"],
},
"node": {
+ "id": summary["node"],
"party": summary["party"],
"votesByItself": summary["votesByItself"],
"revisions": revisions,
@@ -528,7 +530,7 @@ fn render(model: &JsonValue, paint: &Paint) -> Vec<String> {
paint.paint(Style::Id, &text(&node["id"]))
));
let heard = match node["heard"].as_u64() {
- Some(0) => paint.paint(Style::Good, "this node"),
+ _ if node["here"].as_bool() == Some(true) => paint.paint(Style::Good, "this node"),
Some(seconds) if seconds <= LATELY => {
paint.paint(Style::Good, &format!("heard {}", ago(seconds)))
}
@@ -770,19 +772,29 @@ mod tests {
"lass": {
"keys": ["ssh-ed25519 AAAAone"],
"keySet": ["ssh-ed25519 AAAAone"],
- "nodes": [{
- "id": "continuum:9c07",
- "name": "beta",
- "heard": 0,
- "knows": {"wire": [52, 52], "revision": {"named": "the base revision"}},
- }],
+ "nodes": [
+ {
+ "id": "continuum:9c07",
+ "name": "beta",
+ "here": true,
+ "heard": 0,
+ "knows": {"wire": [52, 52], "revision": {"named": "the base revision"}},
+ },
+ {
+ "id": "continuum:3b1e",
+ "name": null,
+ "here": false,
+ "heard": 0,
+ "knows": {"wire": [52, 52], "revision": null},
+ },
+ ],
},
"tv": {
"keys": ["ssh-ed25519 AAAAtwo"],
"keySet": ["ssh-ed25519 AAAAthree"],
"nodes": [
- {"id": "continuum:5be1", "name": null, "heard": LATELY + 1, "knows": null},
- {"id": "continuum:77d0", "name": null, "heard": null, "knows": null},
+ {"id": "continuum:5be1", "name": null, "here": false, "heard": LATELY + 1, "knows": null},
+ {"id": "continuum:77d0", "name": null, "here": false, "heard": null, "knows": null},
],
},
},
@@ -839,6 +851,8 @@ mod tests {
has(" tv");
has(" continuum:9c07 (beta)");
has(" this node; wire 52; the base revision");
+ // Another node heard from within the second is no less another.
+ has(" heard 0 s ago; wire 52; no federation");
has(&format!(
" heard {}; said nothing of what it runs",
ago(LATELY + 1)