kernel: remove btck_chain_get_genesis

It is equivalent to calling btck_chain_get_by_height(0).
This commit is contained in:
stickies-v
2025-11-06 17:34:12 +00:00
parent 513a0da2e0
commit 4dd7e6dc48
4 changed files with 1 additions and 21 deletions

View File

@@ -1242,12 +1242,6 @@ int btck_chain_get_height(const btck_Chain* chain)
return btck_Chain::get(chain).Height();
}
const btck_BlockTreeEntry* btck_chain_get_genesis(const btck_Chain* chain)
{
LOCK(::cs_main);
return btck_BlockTreeEntry::ref(btck_Chain::get(chain).Genesis());
}
const btck_BlockTreeEntry* btck_chain_get_by_height(const btck_Chain* chain, int height)
{
LOCK(::cs_main);

View File

@@ -1222,15 +1222,6 @@ BITCOINKERNEL_API const btck_BlockTreeEntry* BITCOINKERNEL_WARN_UNUSED_RESULT bt
BITCOINKERNEL_API int32_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_get_height(
const btck_Chain* chain) BITCOINKERNEL_ARG_NONNULL(1);
/**
* @brief Get the block tree entry of the genesis block.
*
* @param[in] chain Non-null.
* @return The block tree entry of the genesis block, or null if the chain is empty.
*/
BITCOINKERNEL_API const btck_BlockTreeEntry* BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_get_genesis(
const btck_Chain* chain) BITCOINKERNEL_ARG_NONNULL(1);
/**
* @brief Retrieve a block tree entry by its height in the currently active chain.
* Once retrieved there is no guarantee that it remains in the active chain.

View File

@@ -982,11 +982,6 @@ public:
return btck_chain_get_height(get()) + 1;
}
BlockTreeEntry Genesis() const
{
return btck_chain_get_genesis(get());
}
BlockTreeEntry GetByHeight(int height) const
{
auto index{btck_chain_get_by_height(get(), height)};

View File

@@ -664,7 +664,7 @@ void chainman_reindex_test(TestDirectory& test_directory)
// Sanity check some block retrievals
auto chain{chainman->GetChain()};
BOOST_CHECK_THROW(chain.GetByHeight(1000), std::runtime_error);
auto genesis_index{chain.Genesis()};
auto genesis_index{chain.Entries().front()};
BOOST_CHECK(!genesis_index.GetPrevious());
auto genesis_block_raw{chainman->ReadBlock(genesis_index).value().ToBytes()};
auto first_index{chain.GetByHeight(0)};