Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid unwrap in get_server_stats #3058

Merged
merged 1 commit into from
Sep 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions servers/src/grin/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,16 +495,16 @@ impl Server {
stem_pool_size: self.tx_pool.read().stempool.entries.len(),
};

let head = self.chain.head_header().unwrap();
let head = self.chain.head_header()?;
let head_stats = ChainStats {
latest_timestamp: head.timestamp,
height: head.height,
last_block_h: head.prev_hash,
total_difficulty: head.total_difficulty(),
};

let header_tip = self.chain.header_head().unwrap();
let header = self.chain.get_block_header(&header_tip.hash()).unwrap();
let header_tip = self.chain.header_head()?;
let header = self.chain.get_block_header(&header_tip.hash())?;
let header_stats = ChainStats {
latest_timestamp: header.timestamp,
height: header.height,
Expand Down