I think the new tests belong to the existing test case btck_block_tree_entry_tests:
<details><summary>Diff</summary>
diff --git a/src/test/kernel/test_kernel.cpp b/src/test/kernel/test_kernel.cpp
index 49c7f4a6e4..5399fef761 100644
--- a/src/test/kernel/test_kernel.cpp
+++ b/src/test/kernel/test_kernel.cpp
@@ -973,6 +973,11 @@ BOOST_AUTO_TEST_CASE(btck_block_tree_entry_tests)
auto prev{entry_1.GetPrevious()};
BOOST_CHECK(prev.has_value());
BOOST_CHECK(prev.value() == entry_0);
+
+ // Test GetAncestor
+ BOOST_CHECK(entry_2.GetAncestor(2) == entry_2);
+ BOOST_CHECK(entry_2.GetAncestor(1) == entry_1);
+ BOOST_CHECK(entry_2.GetAncestor(0) == entry_0);
}
BOOST_AUTO_TEST_CASE(btck_chainman_in_memory_tests)
@@ -1178,33 +1183,3 @@ BOOST_AUTO_TEST_CASE(btck_chainman_regtest_tests)
BOOST_CHECK_THROW(chainman->ReadBlockSpentOutputs(tip), std::runtime_error);
}
-BOOST_AUTO_TEST_CASE(btck_block_tree_entry_ancestor_tests)
-{
- auto test_directory{TestDirectory{"ancestor_tests"}};
- auto notifications{std::make_shared<TestKernelNotifications>()};
- auto context{create_context(notifications, ChainType::REGTEST)};
- auto chainman{create_chainman(
- test_directory, /*reindex=*/false, /*wipe_chainstate=*/false,
- /*block_tree_db_in_memory=*/true, /*chainstate_db_in_memory=*/true,
- context)};
- for (const auto& raw_block : REGTEST_BLOCK_DATA) {
- Block block{hex_string_to_byte_vec(raw_block)};
- bool new_block{false};
- BOOST_CHECK(chainman->ProcessBlock(block, &new_block));
- BOOST_CHECK(new_block);
- }
-
- auto tip{chainman->GetBestEntry()};
- int32_t tip_height{tip.GetHeight()};
-
- // GetAncestor at the tip's own height returns the tip.
- auto same{tip.GetAncestor(tip_height)};
- BOOST_REQUIRE(same.has_value());
- BOOST_CHECK(same.value() == tip);
-
- // GetAncestor at height 0 returns the genesis block.
- auto genesis{tip.GetAncestor(0)};
- BOOST_REQUIRE(genesis.has_value());
- BOOST_CHECK_EQUAL(genesis->GetHeight(), 0);
-
-}
</details>