fix: for TUI status try to acquire read lock on pmmr_header but if no… (#3119)

fix: for TUI status try to acquire read lock on pmmr_header but if not available just leave the header stats alone
This commit is contained in:
Joseph Goulden
2019-11-15 07:21:42 +00:00
committed by hashmap
parent 8d2c43d7e8
commit 29b871841a
4 changed files with 38 additions and 20 deletions
+14 -12
View File
@@ -295,18 +295,20 @@ impl TUIStatusListener for TUIStatusView {
c.call_on_id("chain_timestamp", |t: &mut TextView| {
t.set_content(stats.chain_stats.latest_timestamp.to_string());
});
c.call_on_id("basic_header_tip_hash", |t: &mut TextView| {
t.set_content(stats.header_stats.last_block_h.to_string() + "...");
});
c.call_on_id("basic_header_chain_height", |t: &mut TextView| {
t.set_content(stats.header_stats.height.to_string());
});
c.call_on_id("basic_header_total_difficulty", |t: &mut TextView| {
t.set_content(stats.header_stats.total_difficulty.to_string());
});
c.call_on_id("basic_header_timestamp", |t: &mut TextView| {
t.set_content(stats.header_stats.latest_timestamp.to_string());
});
if let Some(header_stats) = &stats.header_stats {
c.call_on_id("basic_header_tip_hash", |t: &mut TextView| {
t.set_content(header_stats.last_block_h.to_string() + "...");
});
c.call_on_id("basic_header_chain_height", |t: &mut TextView| {
t.set_content(header_stats.height.to_string());
});
c.call_on_id("basic_header_total_difficulty", |t: &mut TextView| {
t.set_content(header_stats.total_difficulty.to_string());
});
c.call_on_id("basic_header_timestamp", |t: &mut TextView| {
t.set_content(header_stats.latest_timestamp.to_string());
});
}
c.call_on_id("tx_pool_size", |t: &mut TextView| {
t.set_content(stats.tx_stats.tx_pool_size.to_string());
});