mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-22 19:39:22 +00:00
CI: cleanup build warnings
Tests: fixed "unused const variable" warning CMakeLists.txt: fixed deprecation warnings
This commit is contained in:
parent
741bec9874
commit
76c4573c39
31 changed files with 89 additions and 64 deletions
16
.github/workflows/c-cpp.yml
vendored
16
.github/workflows/c-cpp.yml
vendored
|
@ -98,7 +98,7 @@ jobs:
|
|||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_FLAGS='-Os' -DCMAKE_CXX_FLAGS='-Os' -DWITH_TLS=OFF -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
|
||||
cmake .. -DCMAKE_C_FLAGS='-Os' -DCMAKE_CXX_FLAGS='-Os' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build p2pool
|
||||
|
@ -170,7 +170,7 @@ jobs:
|
|||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_C_FLAGS='-Os' -DCMAKE_CXX_FLAGS='-Os' -DWITH_TLS=OFF -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
|
||||
cmake .. -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_C_FLAGS='-Os' -DCMAKE_CXX_FLAGS='-Os' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build p2pool
|
||||
|
@ -233,7 +233,7 @@ jobs:
|
|||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os ${{ matrix.config.flags }}' -DWITH_TLS=OFF -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DZMQ_HAVE_IPC=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
|
||||
cmake .. -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DZMQ_HAVE_IPC=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build p2pool
|
||||
|
@ -289,7 +289,7 @@ jobs:
|
|||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "${{ matrix.config.vs }}" -DWITH_RANDOMX=${{ matrix.config.rx }} -DWITH_UPNP=${{ matrix.config.upnp }}
|
||||
& "${{ matrix.config.msbuild }}msbuild" /m /p:Configuration=Release p2pool.vcxproj
|
||||
& "${{ matrix.config.msbuild }}msbuild" -v:m /m /p:Configuration=Release p2pool.vcxproj
|
||||
|
||||
- name: Build tests
|
||||
run: |
|
||||
|
@ -297,7 +297,7 @@ jobs:
|
|||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "${{ matrix.config.vs }}"
|
||||
& "${{ matrix.config.msbuild }}msbuild" /m /p:Configuration=Debug p2pool_tests.vcxproj
|
||||
& "${{ matrix.config.msbuild }}msbuild" -v:m /m /p:Configuration=Debug p2pool_tests.vcxproj
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
|
@ -349,7 +349,7 @@ jobs:
|
|||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_FLAGS='-Os' -DCMAKE_CXX_FLAGS='-Os' -DWITH_TLS=OFF -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
|
||||
cmake .. -DCMAKE_C_FLAGS='-Os' -DCMAKE_CXX_FLAGS='-Os' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
|
||||
make -j3
|
||||
|
||||
- name: Build p2pool
|
||||
|
@ -417,7 +417,7 @@ jobs:
|
|||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_FLAGS='-Os -target arm64-apple-${{ matrix.os }}' -DCMAKE_CXX_FLAGS='-Os -target arm64-apple-${{ matrix.os }}' -DWITH_TLS=OFF -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
|
||||
cmake .. -DCMAKE_C_FLAGS='-Os -target arm64-apple-${{ matrix.os }}' -DCMAKE_CXX_FLAGS='-Os -target arm64-apple-${{ matrix.os }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
|
||||
make -j3
|
||||
|
||||
- name: Build p2pool
|
||||
|
@ -473,7 +473,7 @@ jobs:
|
|||
cd ../../libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_FLAGS='-Os' -DCMAKE_CXX_FLAGS='-Os' -DWITH_TLS=OFF -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
|
||||
cmake .. -DCMAKE_C_FLAGS='-Os' -DCMAKE_CXX_FLAGS='-Os' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
|
||||
make -j2
|
||||
cd ../../../..
|
||||
mkdir build
|
||||
|
|
6
.github/workflows/test-sync.yml
vendored
6
.github/workflows/test-sync.yml
vendored
|
@ -107,7 +107,7 @@ jobs:
|
|||
cd external/src/libzmq
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DCMAKE_C_COMPILER=clang-17 -DCMAKE_CXX_COMPILER=clang++-17 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Os -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Os -fno-omit-frame-pointer -g -isystem /tmp/libcxx_msan/include/c++/v1 -L/tmp/libcxx_msan/lib -lc++ -lc++abi -Wno-unused-command-line-argument' -DWITH_TLS=OFF -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
|
||||
cmake .. -DCMAKE_C_COMPILER=clang-17 -DCMAKE_CXX_COMPILER=clang++-17 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Os -fno-omit-frame-pointer -g' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -Os -fno-omit-frame-pointer -g -isystem /tmp/libcxx_msan/include/c++/v1 -L/tmp/libcxx_msan/lib -lc++ -lc++abi -Wno-unused-command-line-argument' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DWITH_PERF_TOOL=OFF
|
||||
make -j$(nproc)
|
||||
|
||||
- name: Build p2pool
|
||||
|
@ -295,7 +295,7 @@ jobs:
|
|||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "Visual Studio 17 2022" -DDEV_TEST_SYNC=ON
|
||||
& "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\msbuild" /m /p:Configuration=Debug p2pool.vcxproj
|
||||
& "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Debug p2pool.vcxproj
|
||||
|
||||
- name: Run p2pool
|
||||
run: |
|
||||
|
@ -338,7 +338,7 @@ jobs:
|
|||
mkdir build
|
||||
cd build
|
||||
cmake .. -G "Visual Studio 17 2022" -DDEV_TEST_SYNC=ON -DDEV_TRACK_MEMORY=ON
|
||||
& "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\msbuild" /m /p:Configuration=RelWithDebInfo p2pool.vcxproj
|
||||
& "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=RelWithDebInfo p2pool.vcxproj
|
||||
|
||||
- name: Run p2pool
|
||||
run: |
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 2.8.12)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(p2pool)
|
||||
|
||||
option(STATIC_BINARY "Build static binary" OFF)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "pool_block.h"
|
||||
#include "p2p_server.h"
|
||||
|
||||
static constexpr char log_category_prefix[] = "BlockCache ";
|
||||
LOG_CATEGORY(BlockCache)
|
||||
|
||||
static constexpr uint32_t BLOCK_SIZE = 96 * 1024;
|
||||
static constexpr uint32_t NUM_BLOCKS = 4608;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <ctime>
|
||||
#include <numeric>
|
||||
|
||||
static constexpr char log_category_prefix[] = "BlockTemplate ";
|
||||
LOG_CATEGORY(BlockTemplate)
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "p2pool_api.h"
|
||||
#include "params.h"
|
||||
|
||||
static constexpr char log_category_prefix[] = "ConsoleCommands ";
|
||||
LOG_CATEGORY(ConsoleCommands)
|
||||
|
||||
static constexpr int DEFAULT_BACKLOG = 1;
|
||||
|
||||
|
@ -123,6 +123,11 @@ void ConsoleCommands::on_shutdown()
|
|||
uv_close(reinterpret_cast<uv_handle_t*>(m_stdin_handle), nullptr);
|
||||
}
|
||||
|
||||
const char* ConsoleCommands::get_log_category() const
|
||||
{
|
||||
return log_category_prefix;
|
||||
}
|
||||
|
||||
typedef struct strconst {
|
||||
const char *str;
|
||||
size_t len;
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
void on_shutdown() override;
|
||||
|
||||
private:
|
||||
const char* get_category() const override { return "ConsoleCommands "; }
|
||||
const char* get_log_category() const override;
|
||||
|
||||
p2pool* m_pool;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "json_rpc_request.h"
|
||||
#include <curl/curl.h>
|
||||
|
||||
static constexpr char log_category_prefix[] = "JSONRPCRequest ";
|
||||
LOG_CATEGORY(JSONRPCRequest)
|
||||
|
||||
namespace p2pool {
|
||||
namespace JSONRPCRequest {
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
static constexpr char log_category_prefix[] = "Log ";
|
||||
LOG_CATEGORY(Log)
|
||||
|
||||
static constexpr char log_file_name[] = "p2pool.log";
|
||||
|
||||
namespace p2pool {
|
||||
|
|
10
src/log.h
10
src/log.h
|
@ -510,17 +510,19 @@ struct DummyStream
|
|||
}
|
||||
#endif
|
||||
|
||||
#define LOG_CATEGORY(category) static constexpr char log_category_prefix[] = #category " ";
|
||||
|
||||
#ifdef P2POOL_LOG_DISABLE
|
||||
|
||||
#define LOGINFO(level, ...) SIDE_EFFECT_CHECK(level, __VA_ARGS__)
|
||||
#define LOGWARN(level, ...) SIDE_EFFECT_CHECK(level, __VA_ARGS__)
|
||||
#define LOGERR(level, ...) SIDE_EFFECT_CHECK(level, __VA_ARGS__)
|
||||
#define LOGINFO(level, ...) SIDE_EFFECT_CHECK(level, log_category_prefix << __VA_ARGS__)
|
||||
#define LOGWARN(level, ...) SIDE_EFFECT_CHECK(level, log_category_prefix << __VA_ARGS__)
|
||||
#define LOGERR(level, ...) SIDE_EFFECT_CHECK(level, log_category_prefix << __VA_ARGS__)
|
||||
|
||||
#else
|
||||
|
||||
#define LOG(level, severity, ...) \
|
||||
do { \
|
||||
SIDE_EFFECT_CHECK(level, __VA_ARGS__); \
|
||||
SIDE_EFFECT_CHECK(level, log_category_prefix << __VA_ARGS__); \
|
||||
if ((level) <= log::GLOBAL_LOG_LEVEL) { \
|
||||
log::Writer CONCAT(log_wrapper_, __LINE__)(severity); \
|
||||
CONCAT(log_wrapper_, __LINE__) << log::Gray() << log_category_prefix; \
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "mempool.h"
|
||||
#include "util.h"
|
||||
|
||||
static constexpr char log_category_prefix[] = "Mempool ";
|
||||
LOG_CATEGORY(Mempool)
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "p2p_server.h"
|
||||
#include <thread>
|
||||
|
||||
static constexpr char log_category_prefix[] = "Miner ";
|
||||
LOG_CATEGORY(Miner)
|
||||
|
||||
using namespace std::chrono;
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
#include <fstream>
|
||||
#include <numeric>
|
||||
|
||||
static constexpr char log_category_prefix[] = "P2PServer ";
|
||||
LOG_CATEGORY(P2PServer)
|
||||
|
||||
static constexpr char saved_peer_list_file_name[] = "p2pool_peers.txt";
|
||||
static const char* seed_nodes[] = { "seeds.p2pool.io", ""};
|
||||
static const char* seed_nodes_mini[] = { "seeds-mini.p2pool.io", "" };
|
||||
|
@ -1049,6 +1050,11 @@ const PoolBlock* P2PServer::find_block(const hash& id) const
|
|||
return m_pool->side_chain().find_block(id);
|
||||
}
|
||||
|
||||
const char* P2PServer::get_log_category() const
|
||||
{
|
||||
return log_category_prefix;
|
||||
}
|
||||
|
||||
void P2PServer::on_timer()
|
||||
{
|
||||
if (m_pool->stopped()) {
|
||||
|
|
|
@ -178,7 +178,7 @@ public:
|
|||
const PoolBlock* find_block(const hash& id) const;
|
||||
|
||||
private:
|
||||
const char* get_category() const override { return "P2PServer "; }
|
||||
const char* get_log_category() const override;
|
||||
|
||||
p2pool* m_pool;
|
||||
BlockCache* m_cache;
|
||||
|
|
|
@ -40,7 +40,8 @@
|
|||
#include <fstream>
|
||||
#include <numeric>
|
||||
|
||||
constexpr char log_category_prefix[] = "P2Pool ";
|
||||
LOG_CATEGORY(P2Pool)
|
||||
|
||||
constexpr int BLOCK_HEADERS_REQUIRED = 720;
|
||||
|
||||
constexpr uint64_t SEEDHASH_EPOCH_BLOCKS = 2048;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
static constexpr char log_category_prefix[] = "P2Pool API ";
|
||||
LOG_CATEGORY(P2Pool API)
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "stratum_server.h"
|
||||
#include "p2p_server.h"
|
||||
|
||||
constexpr char log_category_prefix[] = "P2Pool ";
|
||||
LOG_CATEGORY(Params)
|
||||
|
||||
void p2pool_usage();
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "pow_hash.h"
|
||||
#include "crypto.h"
|
||||
|
||||
static constexpr char log_category_prefix[] = "PoolBlock ";
|
||||
LOG_CATEGORY(PoolBlock)
|
||||
|
||||
#include "pool_block_parser.inl"
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <rapidjson/document.h>
|
||||
#include <thread>
|
||||
|
||||
static constexpr char log_category_prefix[] = "RandomX_Hasher ";
|
||||
LOG_CATEGORY(RandomX_Hasher)
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <iterator>
|
||||
#include <numeric>
|
||||
|
||||
static constexpr char log_category_prefix[] = "SideChain ";
|
||||
LOG_CATEGORY(SideChain)
|
||||
|
||||
static constexpr uint64_t MIN_DIFFICULTY = 100000;
|
||||
static constexpr size_t UNCLE_BLOCK_DEPTH = 3;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "params.h"
|
||||
#include "p2pool_api.h"
|
||||
|
||||
static constexpr char log_category_prefix[] = "StratumServer ";
|
||||
LOG_CATEGORY(StratumServer)
|
||||
|
||||
static constexpr int DEFAULT_BACKLOG = 128;
|
||||
static constexpr uint64_t DEFAULT_BAN_TIME = 600;
|
||||
|
@ -544,6 +544,11 @@ void StratumServer::reset_share_counters()
|
|||
m_totalFailedShares = 0;
|
||||
}
|
||||
|
||||
const char* StratumServer::get_log_category() const
|
||||
{
|
||||
return log_category_prefix;
|
||||
}
|
||||
|
||||
void StratumServer::print_stratum_status() const
|
||||
{
|
||||
uint64_t hashes_15m, hashes_1h, hashes_24h, total_hashes;
|
||||
|
|
|
@ -97,7 +97,7 @@ public:
|
|||
void reset_share_counters();
|
||||
|
||||
private:
|
||||
const char* get_category() const override { return "StratumServer "; }
|
||||
const char* get_log_category() const override;
|
||||
|
||||
void print_stratum_status() const;
|
||||
void update_auto_diff(StratumClient* client, const uint64_t timestamp, const uint64_t hashes);
|
||||
|
|
|
@ -573,13 +573,18 @@ bool TCPServer::send_internal(Client* client, Callback<size_t, uint8_t*, size_t>
|
|||
return true;
|
||||
}
|
||||
|
||||
const char* TCPServer::get_log_category() const
|
||||
{
|
||||
return log_category_prefix;
|
||||
}
|
||||
|
||||
void TCPServer::loop(void* data)
|
||||
{
|
||||
TCPServer* server = static_cast<TCPServer*>(data);
|
||||
server->m_loopThreadRunning.exchange(true);
|
||||
ON_SCOPE_LEAVE([server]() { server->m_loopThreadRunning.exchange(false); });
|
||||
|
||||
log_category_prefix = server->get_category();
|
||||
log_category_prefix = server->get_log_category();
|
||||
|
||||
LOGINFO(1, "event loop started");
|
||||
server_event_loop_thread = data;
|
||||
|
|
|
@ -143,7 +143,7 @@ private:
|
|||
std::vector<uv_tcp_t*> m_listenSockets;
|
||||
|
||||
protected:
|
||||
virtual const char* get_category() const { return "TCPServer "; }
|
||||
virtual const char* get_log_category() const;
|
||||
|
||||
std::vector<uint8_t> m_callbackBuf;
|
||||
int m_defaultBacklog;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include <resolv.h>
|
||||
#endif
|
||||
|
||||
static constexpr char log_category_prefix[] = "Util ";
|
||||
LOG_CATEGORY(Util)
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "json_parsers.h"
|
||||
#include <rapidjson/document.h>
|
||||
|
||||
static constexpr char log_category_prefix[] = "ZMQReader ";
|
||||
LOG_CATEGORY(ZMQReader)
|
||||
|
||||
namespace p2pool {
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 2.8.12)
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(p2pool_tests)
|
||||
|
||||
option(STATIC_LIBS "Use locally built libuv and libzmq static libs" OFF)
|
||||
|
|
|
@ -27,7 +27,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
|||
endif()
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
||||
set(GENERAL_FLAGS "")
|
||||
set(WARNING_FLAGS "/Wall /sdl")
|
||||
set(WARNING_FLAGS "/W4 /sdl")
|
||||
set(SECURITY_FLAGS "/GS /guard:cf")
|
||||
set(OPTIMIZATION_FLAGS "/O2 /Oi /Ob2 /Ot /DNDEBUG /GL")
|
||||
|
||||
|
|
|
@ -74,8 +74,8 @@ TEST(block_template, update)
|
|||
ASSERT_EQ(diff, 300346053753ULL);
|
||||
ASSERT_EQ(sidechain_diff, sidechain.difficulty());
|
||||
ASSERT_EQ(seed_hash, data.seed_hash);
|
||||
ASSERT_EQ(nonce_offset, 39);
|
||||
ASSERT_EQ(template_id, 1);
|
||||
ASSERT_EQ(nonce_offset, 39U);
|
||||
ASSERT_EQ(template_id, 1U);
|
||||
|
||||
hash blobs_hash;
|
||||
keccak(blobs.data(), static_cast<int>(blobs.size()), blobs_hash.h);
|
||||
|
@ -105,8 +105,8 @@ TEST(block_template, update)
|
|||
ASSERT_EQ(diff, 300346053753ULL);
|
||||
ASSERT_EQ(sidechain_diff, sidechain.difficulty());
|
||||
ASSERT_EQ(seed_hash, data.seed_hash);
|
||||
ASSERT_EQ(nonce_offset, 39);
|
||||
ASSERT_EQ(template_id, 2);
|
||||
ASSERT_EQ(nonce_offset, 39U);
|
||||
ASSERT_EQ(template_id, 2U);
|
||||
|
||||
keccak(blobs.data(), static_cast<int>(blobs.size()), blobs_hash.h);
|
||||
ASSERT_EQ(blobs_hash, H("c74d295a9cb7e808030284e2169a6f05b685a11c6c577a774d5eb8fad175d5cd"));
|
||||
|
|
|
@ -567,8 +567,8 @@ TEST(difficulty_type, check_pow)
|
|||
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
// Random difficulty between 300G and 400G
|
||||
difficulty_type diff{ 300000000000ull + (r() % 100000000000ull), 0 };
|
||||
hash h;
|
||||
diff.lo = 300000000000ull + (r() % 100000000000ull);
|
||||
diff.hi = 0;
|
||||
|
||||
// All zeros
|
||||
memset(h.h, 0, HASH_SIZE);
|
||||
|
|
|
@ -57,28 +57,28 @@ TEST(pool_block, deserialize)
|
|||
int outputs_offset, outputs_blob_size;
|
||||
const std::vector<uint8_t> mainchain_data = b.serialize_mainchain_data(&header_size, &miner_tx_size, &outputs_offset, &outputs_blob_size);
|
||||
|
||||
ASSERT_EQ(mainchain_data.size(), 1757);
|
||||
ASSERT_EQ(header_size, 43);
|
||||
ASSERT_EQ(miner_tx_size, 1457);
|
||||
ASSERT_EQ(mainchain_data.size(), 1757U);
|
||||
ASSERT_EQ(header_size, 43U);
|
||||
ASSERT_EQ(miner_tx_size, 1457U);
|
||||
ASSERT_EQ(outputs_offset, 54);
|
||||
ASSERT_EQ(outputs_blob_size, 1371);
|
||||
|
||||
ASSERT_EQ(b.m_majorVersion, 16);
|
||||
ASSERT_EQ(b.m_minorVersion, 16);
|
||||
ASSERT_EQ(b.m_timestamp, 1679221824);
|
||||
ASSERT_EQ(b.m_nonce, 1247);
|
||||
ASSERT_EQ(b.m_txinGenHeight, 2845298);
|
||||
ASSERT_EQ(b.m_outputs.size(), 35);
|
||||
ASSERT_EQ(b.m_extraNonceSize, 4);
|
||||
ASSERT_EQ(b.m_extraNonce, 1482827308);
|
||||
ASSERT_EQ(b.m_transactions.size(), 9);
|
||||
ASSERT_EQ(b.m_uncles.size(), 0);
|
||||
ASSERT_EQ(b.m_sidechainHeight, 4674483);
|
||||
ASSERT_EQ(b.m_difficulty.lo, 1854596983);
|
||||
ASSERT_EQ(b.m_difficulty.hi, 0);
|
||||
ASSERT_EQ(b.m_majorVersion, 16U);
|
||||
ASSERT_EQ(b.m_minorVersion, 16U);
|
||||
ASSERT_EQ(b.m_timestamp, 1679221824U);
|
||||
ASSERT_EQ(b.m_nonce, 1247U);
|
||||
ASSERT_EQ(b.m_txinGenHeight, 2845298U);
|
||||
ASSERT_EQ(b.m_outputs.size(), 35U);
|
||||
ASSERT_EQ(b.m_extraNonceSize, 4U);
|
||||
ASSERT_EQ(b.m_extraNonce, 1482827308U);
|
||||
ASSERT_EQ(b.m_transactions.size(), 9U);
|
||||
ASSERT_EQ(b.m_uncles.size(), 0U);
|
||||
ASSERT_EQ(b.m_sidechainHeight, 4674483U);
|
||||
ASSERT_EQ(b.m_difficulty.lo, 1854596983U);
|
||||
ASSERT_EQ(b.m_difficulty.hi, 0U);
|
||||
ASSERT_EQ(b.m_cumulativeDifficulty.lo, 7172845253120126ull);
|
||||
ASSERT_EQ(b.m_cumulativeDifficulty.hi, 0);
|
||||
ASSERT_EQ(b.m_depth, 0);
|
||||
ASSERT_EQ(b.m_cumulativeDifficulty.hi, 0U);
|
||||
ASSERT_EQ(b.m_depth, 0U);
|
||||
ASSERT_EQ(b.m_verified, false);
|
||||
ASSERT_EQ(b.m_invalid, false);
|
||||
ASSERT_EQ(b.m_broadcasted, false);
|
||||
|
|
Loading…
Reference in a new issue