pub trait ToBlockHash {
/// Returns the [`BlockHash`] for the associated [`CheckPoint`] `data` type.
fn to_blockhash(&self) -> BlockHash;
+
+ /// Returns `None` if the type has no knowledge of the previous [`BlockHash`].
+ fn prev_blockhash(&self) -> Option<BlockHash> {
+ None
+ }
}
impl ToBlockHash for BlockHash {
fn to_blockhash(&self) -> BlockHash {
self.block_hash()
}
+
+ fn prev_blockhash(&self) -> Option<BlockHash> {
+ Some(self.prev_blockhash)
+ }
}
/// Trait that extracts a block time from [`CheckPoint`] `data`.