mirror of
https://github.com/SChernykh/p2pool.git
synced 2025-01-03 09:19:24 +00:00
Added a test for mini chain
This commit is contained in:
parent
bde5b19c77
commit
b9eb66e2b3
3 changed files with 19 additions and 4 deletions
|
@ -148,3 +148,4 @@ target_link_libraries(${CMAKE_PROJECT_NAME} debug ${ZMQ_LIBRARY_DEBUG} debug ${U
|
|||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/src/crypto_tests.txt" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
||||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/src/mainnet_test2_block.dat" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
||||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/src/sidechain_dump.dat" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
||||
add_custom_command(TARGET ${CMAKE_PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/src/sidechain_dump_mini.dat" $<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>)
|
||||
|
|
|
@ -103,11 +103,24 @@ TEST(pool_block, deserialize)
|
|||
TEST(pool_block, verify)
|
||||
{
|
||||
init_crypto_cache();
|
||||
|
||||
struct STest
|
||||
{
|
||||
const char* m_poolName;
|
||||
const char* m_fileName;
|
||||
uint64_t m_txinGenHeight;
|
||||
uint64_t m_sidechainHeight;
|
||||
} tests[2] = {
|
||||
{ "default", "sidechain_dump.dat", 2483901, 522805 },
|
||||
{ "mini", "sidechain_dump_mini.dat", 2696040, 2424349 },
|
||||
};
|
||||
|
||||
for (const STest& t : tests)
|
||||
{
|
||||
PoolBlock b;
|
||||
SideChain sidechain(nullptr, NetworkType::Mainnet);
|
||||
SideChain sidechain(nullptr, NetworkType::Mainnet, t.m_poolName);
|
||||
|
||||
std::ifstream f("sidechain_dump.dat", std::ios::binary | std::ios::ate);
|
||||
std::ifstream f(t.m_fileName, std::ios::binary | std::ios::ate);
|
||||
ASSERT_EQ(f.good() && f.is_open(), true);
|
||||
|
||||
std::vector<uint8_t> buf(f.tellg());
|
||||
|
@ -133,9 +146,10 @@ TEST(pool_block, verify)
|
|||
ASSERT_TRUE(tip->m_verified);
|
||||
ASSERT_FALSE(tip->m_invalid);
|
||||
|
||||
ASSERT_EQ(tip->m_txinGenHeight, 2483901);
|
||||
ASSERT_EQ(tip->m_sidechainHeight, 522805);
|
||||
ASSERT_EQ(tip->m_txinGenHeight, t.m_txinGenHeight);
|
||||
ASSERT_EQ(tip->m_sidechainHeight, t.m_sidechainHeight);
|
||||
}
|
||||
|
||||
destroy_crypto_cache();
|
||||
}
|
||||
|
||||
|
|
BIN
tests/src/sidechain_dump_mini.dat
Normal file
BIN
tests/src/sidechain_dump_mini.dat
Normal file
Binary file not shown.
Loading…
Reference in a new issue