kernel: remove btck_chain_get_tip

It is equivalent to calling btck_chain_get_by_height with the
height obtained from btck_chain_get_height. In neither case do we
provide guarantees that the returned block index still corresponds
to the actual tip.
This commit is contained in:
stickies-v
2025-11-07 16:43:20 +00:00
parent 4dd7e6dc48
commit 66978a1a95
4 changed files with 3 additions and 24 deletions

View File

@@ -676,7 +676,7 @@ void chainman_reindex_test(TestDirectory& test_directory)
auto next_index{chain.GetByHeight(first_index.GetHeight() + 1)};
BOOST_CHECK(chain.Contains(next_index));
auto next_block_data{chainman->ReadBlock(next_index).value().ToBytes()};
auto tip_index{chain.Tip()};
auto tip_index{chain.Entries().back()};
auto tip_block_data{chainman->ReadBlock(tip_index).value().ToBytes()};
auto second_index{chain.GetByHeight(1)};
auto second_block{chainman->ReadBlock(second_index).value()};
@@ -755,7 +755,7 @@ void chainman_mainnet_validation_test(TestDirectory& test_directory)
auto chain{chainman->GetChain()};
BOOST_CHECK_EQUAL(chain.Height(), 1);
auto tip{chain.Tip()};
auto tip{chain.Entries().back()};
auto read_block{chainman->ReadBlock(tip)};
BOOST_REQUIRE(read_block);
check_equal(read_block.value().ToBytes(), raw_block);
@@ -851,7 +851,7 @@ BOOST_AUTO_TEST_CASE(btck_chainman_regtest_tests)
}
auto chain = chainman->GetChain();
auto tip = chain.Tip();
auto tip = chain.Entries().back();
auto read_block = chainman->ReadBlock(tip).value();
check_equal(read_block.ToBytes(), hex_string_to_byte_vec(REGTEST_BLOCK_DATA[REGTEST_BLOCK_DATA.size() - 1]));