Return target_hash for finality_target instead of an Option (#9867)

* .

cargo +nightly fmt --all

* Fix test

* Simplify test

* They are already imported

* Needless clone()
This commit is contained in:
Liu-Cheng Xu authored and GitHub committed 2021-09-29 13:03:09 +00:00
1 parent 2deed49706
commit 802afa9f22
5 files changed
+96 -378

No files matched your search

@@ -91,11 +91,12 @@ where
&self,
target_hash: Block::Hash,
maybe_max_number: Option<NumberFor<Block>>,
) -> Result<Option<Block::Hash>, ConsensusError> {
) -> Result<Block::Hash, ConsensusError> {
let import_lock = self.backend.get_import_lock();
self.backend
.blockchain()
.best_containing(target_hash, maybe_max_number, import_lock)
.map(|maybe_hash| maybe_hash.unwrap_or(target_hash))
.map_err(|e| ConsensusError::ChainLookup(e.to_string()).into())
}
}