kernel: remove btck_chain_get_genesis
It is equivalent to calling btck_chain_get_by_height(0).
This commit is contained in:
4 files changed
+1
-21
No files matched your search
@@ -1242,12 +1242,6 @@ int btck_chain_get_height(const btck_Chain* chain)
|
|||||||
return btck_Chain::get(chain).Height();
|
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)
|
const btck_BlockTreeEntry* btck_chain_get_by_height(const btck_Chain* chain, int height)
|
||||||
{
|
{
|
||||||
LOCK(::cs_main);
|
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(
|
BITCOINKERNEL_API int32_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_get_height(
|
||||||
const btck_Chain* chain) BITCOINKERNEL_ARG_NONNULL(1);
|
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.
|
* @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.
|
* 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;
|
return btck_chain_get_height(get()) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockTreeEntry Genesis() const
|
|
||||||
{
|
|
||||||
return btck_chain_get_genesis(get());
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockTreeEntry GetByHeight(int height) const
|
BlockTreeEntry GetByHeight(int height) const
|
||||||
{
|
{
|
||||||
auto index{btck_chain_get_by_height(get(), height)};
|
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
|
// Sanity check some block retrievals
|
||||||
auto chain{chainman->GetChain()};
|
auto chain{chainman->GetChain()};
|
||||||
BOOST_CHECK_THROW(chain.GetByHeight(1000), std::runtime_error);
|
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());
|
BOOST_CHECK(!genesis_index.GetPrevious());
|
||||||
auto genesis_block_raw{chainman->ReadBlock(genesis_index).value().ToBytes()};
|
auto genesis_block_raw{chainman->ReadBlock(genesis_index).value().ToBytes()};
|
||||||
auto first_index{chain.GetByHeight(0)};
|
auto first_index{chain.GetByHeight(0)};
|
||||||
|
|||||||
Reference in new issue
Block a user