Fix longest chain finalization target lookup (#13289)

* Finalization target should be chosed as some ancestor of SelectChain::best_chain

* More test assertions

* Improve docs

* Removed stale docs

* Rename 'target' to 'base' in lookup method

* Fix typo

* Apply suggestions from code review

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Rename 'target_hash' to 'base_hash' in 'SelectChain::finality_target()'

* Apply suggestions from code review

Co-authored-by: Anton <anton.kalyaev@gmail.com>

* Docs improvement

* Doc fix

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <git@kchr.de>

* Apply more code suggestions

---------

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: Anton <anton.kalyaev@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Davide Galassi
2023-02-11 18:35:04 +01:00
committed by GitHub
parent 9a8bbbab03
commit d48fc58729
5 changed files with 242 additions and 149 deletions
@@ -237,7 +237,7 @@ impl SelectChain<Block> for MockSelectChain {
async fn finality_target(
&self,
_target_hash: Hash,
_base_hash: Hash,
_maybe_max_number: Option<NumberFor<Block>>,
) -> Result<Hash, ConsensusError> {
Ok(self.finality_target.lock().take().unwrap())