client: Reorg to new best when finalizing divergent branch (#2869)

* client: add tests for reorging on diverged finality

* client: mark finalized block as best if diverged from current best chain

* client: update meta on set_head

* core: add docs about SelectChain to finalize_block

* client: improve finality reorg test

* client: LongestChain doesn't return client best block

* client: LongestChain searches canonical chain
This commit is contained in:
André Silva
2019-07-16 00:50:22 +01:00
committed by Gavin Wood
parent babfc44736
commit f74c2676da
3 changed files with 155 additions and 15 deletions
+1
View File
@@ -1118,6 +1118,7 @@ impl<Block: BlockT<Hash=H256>> Backend<Block> {
hash.clone(),
(number.clone(), hash.clone())
)?;
meta_updates.push((hash, *number, true, false));
} else {
return Err(client::error::Error::UnknownBlock(format!("Cannot set head {:?}", set_head)))
}