CI: added more tests

This commit is contained in:
SChernykh
2025-06-22 21:58:57 +02:00
parent e69f5722df
commit e5d487aa50
6 changed files with 37 additions and 1 deletions

View File

@@ -26,6 +26,12 @@ namespace p2pool {
void merkle_hash(const std::vector<hash>& hashes, root_hash& root)
{
const size_t count = hashes.size();
if (count == 0) {
root.clear();
return;
}
const uint8_t* h = hashes[0].h;
if (count == 1) {
@@ -62,10 +68,15 @@ void merkle_hash(const std::vector<hash>& hashes, root_hash& root)
void merkle_hash_full_tree(const std::vector<hash>& hashes, std::vector<std::vector<hash>>& tree)
{
const size_t count = hashes.size();
const uint8_t* h = hashes[0].h;
tree.clear();
if (count == 0) {
return;
}
const uint8_t* h = hashes[0].h;
if (count == 1) {
tree.push_back(hashes);
}

View File

@@ -175,6 +175,8 @@ template<> FORCEINLINE bool out_of_range<uint64_t>(uint64_t) { return false; }
template<typename T>
const uint8_t* readVarint(const uint8_t* data, const uint8_t* data_end, T& b)
{
static_assert(std::is_unsigned_v<T>, "readVarint works only with unsigned types");
uint64_t result = 0;
int k = 0;