aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/federation/party.rs19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/federation/party.rs b/src/federation/party.rs
index a1eb6a0..29d9cb8 100644
--- a/src/federation/party.rs
+++ b/src/federation/party.rs
@@ -1604,14 +1604,13 @@ fn consistent(counts: &JsonValue, current: &Version, record: &Record) -> Result<
/// How the party's votes on `current` that `counts` shows differ from `record`'s: those the
/// node shows that the record lacks, and those the record holds that the node doesn't show;
-/// each as `true on 8d02…`.
+/// each as `` `true` on <proposal's hash> ``.
fn unrecorded(
counts: &JsonValue,
current: &Version,
record: &Record,
) -> (Vec<String>, Vec<String>) {
let party = record.party.as_str();
- let short = |hash: &str| format!("{}…", hash.get(..12).unwrap_or(hash));
let mut shown = Vec::new();
for (hash, ballot) in counts["proposals"].as_object().into_iter().flatten() {
for (what, yes) in [("yes", true), ("no", false)] {
@@ -1628,7 +1627,7 @@ fn unrecorded(
.into_iter()
.map(|(proposal, yes)| (proposal.to_string(), yes))
.collect();
- let spelled = |(hash, yes): &(String, bool)| format!("`{yes}` on {}", short(hash));
+ let spelled = |(hash, yes): &(String, bool)| format!("`{yes}` on {hash}");
(
shown
.iter()
@@ -1828,16 +1827,12 @@ async fn status(node: &Node, options: &Options, party: Option<&str>) -> Result<(
let summary = node.get("/events").await?;
let counts = node.counts().await?;
let current = current(&counts)?;
- let short = |id: &str| match id.get(..12) {
- Some(start) if id.len() > 12 => format!("{start}…"),
- _ => id.to_owned(),
- };
let text = |value: &JsonValue| value.as_str().unwrap_or_default().to_owned();
let plural =
|n: usize, one: &str, many: &str| format!("{n} {}", if n == 1 { one } else { many });
let heads = summary["heads"].as_array().map_or(0, Vec::len);
- println!("store {}", short(&text(&summary["store"])));
- println!(" checkpoint {}", short(&text(&summary["checkpoint"])));
+ println!("store {}", text(&summary["store"]));
+ println!(" checkpoint {}", text(&summary["checkpoint"]));
println!(
" {}, {} taken after the checkpoint",
plural(heads, "head", "heads"),
@@ -1848,11 +1843,7 @@ async fn status(node: &Node, options: &Options, party: Option<&str>) -> Result<(
)
);
let needed = (2 * current.parties.len()).div_ceil(3);
- println!(
- "version {} ({})",
- current.number,
- short(&current.hash.to_string())
- );
+ println!("version {} ({})", current.number, current.hash);
println!(
" federation {}, {}",
counts["version"]["version"]["federation"], current.revision