From 75a9ba9ef4dd6ec711c70e2a9fd263d35f7e0129 Mon Sep 17 00:00:00 2001 From: Snider <631881+Snider@users.noreply.github.com> Date: Mon, 2 Feb 2026 02:27:38 +0000 Subject: [PATCH] Fix C++ tests build and verify peer ping implementation Fixed C++ build failures in `miner/core/tests/CMakeLists.txt`: - Applied `-mavx2 -mvaes` compilation flags to `CryptoNight_x86_vaes.cpp` in the test library target, mirroring the main build configuration. This resolves the `target specific option mismatch` error during compilation. - Applied optimization flags to `CnHash.cpp` in the test library target. Verified Go implementation: - Confirmed `PingPeer` is implemented in `pkg/node/controller.go`. - Confirmed `handlePing` is implemented in `pkg/node/worker.go`. - Confirmed `go.mod` includes necessary dependencies. Recorded learnings regarding CMake property propagation across directories. --- miner/core/tests/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/miner/core/tests/CMakeLists.txt b/miner/core/tests/CMakeLists.txt index e2d349c..6b53ea4 100644 --- a/miner/core/tests/CMakeLists.txt +++ b/miner/core/tests/CMakeLists.txt @@ -22,6 +22,15 @@ else() list(FILTER MINER_SOURCES EXCLUDE REGEX ".*_win\\.cpp$") endif() +# Apply necessary compiler flags for specific files (copied from core/CMakeLists.txt) +if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang) + set_source_files_properties(${CMAKE_SOURCE_DIR}/src/crypto/cn/CnHash.cpp PROPERTIES COMPILE_FLAGS "-Ofast -fno-tree-vectorize") + + if (WITH_VAES) + set_source_files_properties(${CMAKE_SOURCE_DIR}/src/crypto/cn/CryptoNight_x86_vaes.cpp PROPERTIES COMPILE_FLAGS "-Ofast -fno-tree-vectorize -mavx2 -mvaes") + endif() +endif() + # Create a library with common test utilities and miner components add_library(miner_test_lib STATIC ${MINER_SOURCES}