kernel: add btck_block_tree_entry_equals

BlockTreeEntry objects are often compared. By exposing an equality
function, clients don't have to implement more expensive
comparisons based on height and block hash.
This commit is contained in:
stickies-v
2025-11-11 15:09:56 +00:00
parent 1c3d5c8ffd
commit 096924d39d
4 changed files with 63 additions and 0 deletions

View File

@@ -1104,6 +1104,11 @@ const btck_BlockHash* btck_block_tree_entry_get_block_hash(const btck_BlockTreeE
return btck_BlockHash::ref(btck_BlockTreeEntry::get(entry).phashBlock);
}
int btck_block_tree_entry_equals(const btck_BlockTreeEntry* entry1, const btck_BlockTreeEntry* entry2)
{
return &btck_BlockTreeEntry::get(entry1) == &btck_BlockTreeEntry::get(entry2);
}
btck_BlockHash* btck_block_hash_create(const unsigned char block_hash[32])
{
return btck_BlockHash::create(std::span<const unsigned char>{block_hash, 32});