Safe TreeRoute constructor (#12691)

* Safe TreeRoute constructor
* Remove test duplicate
* Better tree route error info
This commit is contained in:
Davide Galassi
2022-11-11 16:22:26 +01:00
committed by GitHub
parent 3e6cd742e0
commit 8c423baf32
3 changed files with 43 additions and 21 deletions
+8
View File
@@ -2796,6 +2796,14 @@ pub(crate) mod tests {
let b1 = insert_header(&backend, 1, block0, None, H256::from([1; 32]));
let b2 = insert_header(&backend, 2, b1, None, Default::default());
{
let tree_route = tree_route(blockchain, a1, a1).unwrap();
assert_eq!(tree_route.common_block().hash, a1);
assert!(tree_route.retracted().is_empty());
assert!(tree_route.enacted().is_empty());
}
{
let tree_route = tree_route(blockchain, a3, b2).unwrap();