show header and chain tip hashes on status page in tui (#1951)

This commit is contained in:
Antioch Peverell 2018-11-09 15:14:25 +00:00 committed by GitHub
parent 39ebb33ba1
commit 408fcc386e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,6 +47,10 @@ impl TUIStatusListener for TUIStatusView {
).child( ).child(
LinearLayout::new(Orientation::Horizontal) LinearLayout::new(Orientation::Horizontal)
.child(TextView::new("------------------------")), .child(TextView::new("------------------------")),
).child(
LinearLayout::new(Orientation::Horizontal)
.child(TextView::new("Header Tip Hash: "))
.child(TextView::new(" ").with_id("basic_header_tip_hash")),
).child( ).child(
LinearLayout::new(Orientation::Horizontal) LinearLayout::new(Orientation::Horizontal)
.child(TextView::new("Header Chain Height: ")) .child(TextView::new("Header Chain Height: "))
@ -58,6 +62,10 @@ impl TUIStatusListener for TUIStatusView {
).child( ).child(
LinearLayout::new(Orientation::Horizontal) LinearLayout::new(Orientation::Horizontal)
.child(TextView::new("------------------------")), .child(TextView::new("------------------------")),
).child(
LinearLayout::new(Orientation::Horizontal)
.child(TextView::new("Tip Hash: "))
.child(TextView::new(" ").with_id("tip_hash")),
).child( ).child(
LinearLayout::new(Orientation::Horizontal) LinearLayout::new(Orientation::Horizontal)
.child(TextView::new("Chain Height: ")) .child(TextView::new("Chain Height: "))
@ -213,12 +221,18 @@ impl TUIStatusListener for TUIStatusView {
c.call_on_id("connected_peers", |t: &mut TextView| { c.call_on_id("connected_peers", |t: &mut TextView| {
t.set_content(stats.peer_count.to_string()); t.set_content(stats.peer_count.to_string());
}); });
c.call_on_id("tip_hash", |t: &mut TextView| {
t.set_content(stats.head.last_block_h.to_string());
});
c.call_on_id("chain_height", |t: &mut TextView| { c.call_on_id("chain_height", |t: &mut TextView| {
t.set_content(stats.head.height.to_string()); t.set_content(stats.head.height.to_string());
}); });
c.call_on_id("basic_total_difficulty", |t: &mut TextView| { c.call_on_id("basic_total_difficulty", |t: &mut TextView| {
t.set_content(stats.head.total_difficulty.to_string()); t.set_content(stats.head.total_difficulty.to_string());
}); });
c.call_on_id("basic_header_tip_hash", |t: &mut TextView| {
t.set_content(stats.header_head.last_block_h.to_string());
});
c.call_on_id("basic_header_chain_height", |t: &mut TextView| { c.call_on_id("basic_header_chain_height", |t: &mut TextView| {
t.set_content(stats.header_head.height.to_string()); t.set_content(stats.header_head.height.to_string());
}); });