mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-22 19:39:22 +00:00
Fixed pool_block.deserialize
test
This commit is contained in:
parent
6685a22118
commit
79ad29e99a
1 changed files with 23 additions and 12 deletions
|
@ -84,19 +84,31 @@ TEST(pool_block, deserialize)
|
||||||
ASSERT_EQ(b.m_broadcasted, false);
|
ASSERT_EQ(b.m_broadcasted, false);
|
||||||
ASSERT_EQ(b.m_wantBroadcast, false);
|
ASSERT_EQ(b.m_wantBroadcast, false);
|
||||||
|
|
||||||
#if !(defined(__FreeBSD__) || defined(__OpenBSD__))
|
class RandomX_Hasher_Test : public RandomX_Hasher_Base
|
||||||
RandomX_Hasher hasher(nullptr);
|
|
||||||
|
|
||||||
hash seed;
|
|
||||||
{
|
{
|
||||||
std::stringstream s;
|
public:
|
||||||
s << "6fc9c4a55eb513eb31955c084d9342e0082987f9e42da042449b7c9001176d3a";
|
bool calculate(const void* data, size_t size, uint64_t, const hash&, hash& result) override
|
||||||
s >> seed;
|
{
|
||||||
}
|
if (size == 76) {
|
||||||
|
char buf[76 * 2 + 1];
|
||||||
|
{
|
||||||
|
log::Stream s(buf);
|
||||||
|
s << log::hex_buf(reinterpret_cast<const uint8_t*>(data), size);
|
||||||
|
buf[76 * 2] = '\0';
|
||||||
|
}
|
||||||
|
const char ref[] = "1010c0c8dba006b78e04571806733a74ef1014f404484d3358bfca889a75bb0fe9aff64a41c92bdf040000ecf0a11f83c6eced7d7cdfbdcd5a193f64d334b2c5491a9c595b4527e531ae7209";
|
||||||
|
if (memcmp(buf, ref, sizeof(buf)) == 0) {
|
||||||
|
std::stringstream s;
|
||||||
|
s << "aa7a3c4a2d67cb6a728e244288219bf038024f3b511b0da197a19ec601000000";
|
||||||
|
s >> result;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} hasher;
|
||||||
|
|
||||||
hasher.set_seed(seed);
|
hash seed, pow_hash;
|
||||||
|
|
||||||
hash pow_hash;
|
|
||||||
ASSERT_EQ(b.get_pow_hash(&hasher, 0, seed, pow_hash), true);
|
ASSERT_EQ(b.get_pow_hash(&hasher, 0, seed, pow_hash), true);
|
||||||
|
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
|
@ -104,7 +116,6 @@ TEST(pool_block, deserialize)
|
||||||
ASSERT_EQ(s.str(), "aa7a3c4a2d67cb6a728e244288219bf038024f3b511b0da197a19ec601000000");
|
ASSERT_EQ(s.str(), "aa7a3c4a2d67cb6a728e244288219bf038024f3b511b0da197a19ec601000000");
|
||||||
|
|
||||||
ASSERT_EQ(b.m_difficulty.check_pow(pow_hash), true);
|
ASSERT_EQ(b.m_difficulty.check_pow(pow_hash), true);
|
||||||
#endif
|
|
||||||
|
|
||||||
destroy_crypto_cache();
|
destroy_crypto_cache();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue