mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-19 23:03:45 +01:00
kernel: remove btck_chain_get_genesis
It is equivalent to calling btck_chain_get_by_height(0).
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)};
|
||||
|
||||
@@ -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)};
|
||||
|
||||
Reference in New Issue
Block a user