Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Block::decode() returns Result (#8586)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdplm authored and ascjones committed May 14, 2018
1 parent 78edfe5 commit a315952
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ethcore/src/encoded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl Block {
pub fn header_view(&self) -> HeaderView { self.view().header_view() }

/// Decode to a full block.
pub fn decode(&self) -> FullBlock { ::rlp::decode(&self.0).expect("decoding failure") }
pub fn decode(&self) -> Result<FullBlock, rlp::DecoderError> { rlp::decode(&self.0) }

/// Decode the header.
pub fn decode_header(&self) -> FullHeader { self.view().rlp().val_at(0) }
Expand Down
2 changes: 1 addition & 1 deletion ethcore/src/snapshot/consensus/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl SnapshotComponents for PoaSnapshot {
let (block, receipts) = chain.block(&block_at)
.and_then(|b| chain.block_receipts(&block_at).map(|r| (b, r)))
.ok_or(Error::BlockNotFound(block_at))?;
let block = block.decode();
let block = block.decode()?;

let parent_td = chain.block_details(block.header.parent_hash())
.map(|d| d.total_difficulty)
Expand Down

0 comments on commit a315952

Please sign in to comment.