We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5f9390c commit 13dcb04Copy full SHA for 13dcb04
lightning-block-sync/src/convert.rs
@@ -49,11 +49,9 @@ impl TryInto<BlockHash> for BinaryResponse {
49
type Error = std::io::Error;
50
51
fn try_into(self) -> std::io::Result<BlockHash> {
52
- if self.0.len() != 32 {
+ BlockHash::from_slice(&self.0).map_err(|_|
53
Err(std::io::Error::new(std::io::ErrorKind::InvalidData, "bad block hash length"))
54
- } else {
55
- Ok(BlockHash::from_slice(&self.0).unwrap())
56
- }
+ )?
57
}
58
59
0 commit comments