kernel: align height parameters to int32_t in btck API

Aligns btck_chain_get_height and btck_chain_get_by_height to use int32_t
for height parameters and return values. Updates the C++ wrapper
accordingly.
This commit is contained in:
Alexander Wiederin
2026-04-16 16:21:21 +02:00
parent c4361e53cd
commit ba6287a449
3 changed files with 5 additions and 5 deletions

View File

@@ -1352,13 +1352,13 @@ const btck_Chain* btck_chainstate_manager_get_active_chain(const btck_Chainstate
return btck_Chain::ref(&WITH_LOCK(btck_ChainstateManager::get(chainman).m_chainman->GetMutex(), return btck_ChainstateManager::get(chainman).m_chainman->ActiveChain()));
}
int btck_chain_get_height(const btck_Chain* chain)
int32_t btck_chain_get_height(const btck_Chain* chain)
{
LOCK(::cs_main);
return btck_Chain::get(chain).Height();
}
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, int32_t height)
{
LOCK(::cs_main);
return btck_BlockTreeEntry::ref(btck_Chain::get(chain)[height]);

View File

@@ -1423,7 +1423,7 @@ BITCOINKERNEL_API int32_t BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_get_height
*/
BITCOINKERNEL_API const btck_BlockTreeEntry* BITCOINKERNEL_WARN_UNUSED_RESULT btck_chain_get_by_height(
const btck_Chain* chain,
int block_height) BITCOINKERNEL_ARG_NONNULL(1);
int32_t block_height) BITCOINKERNEL_ARG_NONNULL(1);
/**
* @brief Return true if the passed in chain contains the block tree entry.

View File

@@ -1122,12 +1122,12 @@ public:
return btck_chain_get_height(get());
}
int CountEntries() const
int32_t CountEntries() const
{
return btck_chain_get_height(get()) + 1;
}
BlockTreeEntry GetByHeight(int height) const
BlockTreeEntry GetByHeight(int32_t height) const
{
auto index{btck_chain_get_by_height(get(), height)};
if (!index) throw std::runtime_error("No entry in the chain at the provided height");