Skip to content

Commit

Permalink
Log more information in case of invalid hash
Browse files Browse the repository at this point in the history
  • Loading branch information
romanz committed Jul 16, 2018
1 parent 2a3678e commit 1b4adfd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ pub enum Network {
}

fn parse_hash(value: &Value) -> Result<Sha256dHash> {
Ok(
Sha256dHash::from_hex(value.as_str().chain_err(|| "non-string value")?)
.chain_err(|| "non-hex value")?,
)
Ok(Sha256dHash::from_hex(value
.as_str()
.chain_err(|| format!("non-string value: {}", value))?)
.chain_err(|| {
format!("non-hex value: {}", value)
})?)
}

fn header_from_value(value: Value) -> Result<BlockHeader> {
Expand Down

0 comments on commit 1b4adfd

Please sign in to comment.