Compare commits

...

95 Commits

Author SHA1 Message Date
SChernykh 1963f7e9e6 p2pool v4.15 2026-05-01 10:32:03 +02:00
SChernykh 35ca86d4b9 Fixed cmake options for curl 2026-04-30 17:17:03 +02:00
SChernykh d3b1a77256 Updated curl to 8.20.0, disabled threaded resolver 2026-04-30 15:05:02 +02:00
SChernykh fb8fdfe4fb Disable empty id in pruned blocks 2026-04-29 23:00:49 +02:00
SChernykh 03aa77c327 More PoolBlock fixes 2026-04-29 21:35:46 +02:00
SChernykh 836b29faec Reverted curl to 8.19.0
macos sync test was failing
2026-04-29 16:30:20 +02:00
SChernykh a0b84113f4 Added i2p seeds, updated build scripts 2026-04-29 14:56:43 +02:00
SChernykh 0742f42ecd Updated curl cmake command 2026-04-29 11:24:31 +02:00
SChernykh 374abee844 Updated curl to 8.20.0 2026-04-29 09:23:18 +02:00
SChernykh 732b17b32f Fixed CI 2026-04-28 20:52:38 +02:00
SChernykh 620b2e12f7 Added command line parameters to disable logging 2026-04-28 18:48:10 +02:00
SChernykh 01da461069 Compiler test scripts: added clang-22 2026-04-28 15:36:50 +02:00
SChernykh cff5d60d89 Fixed cppcheck errors 2026-04-28 06:27:41 +02:00
SChernykh cb7b812469 Logger performance improvements and fixes 2026-04-27 23:20:34 +02:00
SChernykh 90f11d576a BlockTemplate fixes 2026-04-26 23:25:51 +02:00
SChernykh fc4b979c80 Fixed CI 2026-04-26 21:06:55 +02:00
SChernykh 4ebae25093 json_rpc_request fixes 2026-04-26 19:35:13 +02:00
SChernykh cd1ea288df indexed_hash fixes and small speedup 2026-04-26 10:00:31 +02:00
SChernykh bfa60422c4 Fixed tests 2026-04-26 06:52:42 +02:00
SChernykh 87cc4aa76a SideChain: tweaked block pruning 2026-04-25 22:52:05 +02:00
SChernykh fb88033504 SideChain fixes 2026-04-25 22:32:02 +02:00
SChernykh ab0d58102f Fixed CI errors 2026-04-25 19:53:17 +02:00
SChernykh 7150cf875f StratumServer: limit max client score, other small fixes 2026-04-25 17:49:58 +02:00
SChernykh 064b5b24dc Updated RandomX 2026-04-25 15:52:33 +02:00
SChernykh f906e9ecd0 Fixed CI 2026-04-25 12:12:58 +02:00
SChernykh 7ca1beeb73 P2PServer fixes (peer list loading, peer id and other smaller fixes)
C/C++ CI / build-alpine-static (map[arch:aarch64 branch:latest-stable flags:-ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419]) (push) Failing after 31s
C/C++ CI / build-alpine-static (map[arch:riscv64 branch:latest-stable flags:-ffunction-sections]) (push) Failing after 7s
C/C++ CI / build-alpine-static (map[arch:x86_64 branch:latest-stable flags:-ffunction-sections]) (push) Failing after 9s
C/C++ CI / build-ubuntu (map[c:gcc-10 cpp:g++-10 flags: os:ubuntu-22.04]) (push) Failing after 10m28s
C/C++ CI / build-ubuntu (map[c:gcc-11 cpp:g++-11 flags: os:ubuntu-22.04]) (push) Failing after 9m1s
Sync test / sync-test-ubuntu-msan (push) Has been cancelled
Sync test / sync-test-ubuntu-ubsan (push) Has been cancelled
Sync test / sync-test-ubuntu-asan (push) Has been cancelled
Sync test / sync-test-ubuntu-tysan (push) Has been cancelled
Sync test / sync-test-macos (map[flags: os:macos-26-intel]) (push) Has been cancelled
Sync test / sync-test-macos (map[flags:-target arm64-apple-macos-11 os:macos-26]) (push) Has been cancelled
Sync test / sync-test-windows-debug-asan (push) Has been cancelled
Sync test / sync-test-windows-leaks (push) Has been cancelled
clang-tidy / clang-tidy (push) Has been cancelled
CodeQL / Analyze (cpp) (push) Has been cancelled
Code coverage / coverage (push) Has been cancelled
cppcheck / cppcheck-ubuntu (push) Has been cancelled
cppcheck / cppcheck-windows (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-13 cpp:g++-13 flags: os:ubuntu-24.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-14 cpp:g++-14 flags: os:ubuntu-24.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-9 cpp:g++-9 flags: os:ubuntu-22.04]) (push) Has been cancelled
C/C++ CI / build-ubuntu-static-libs (map[flags:-fuse-linker-plugin -ffunction-sections]) (push) Has been cancelled
C/C++ CI / build-ubuntu-aarch64 (map[flags:-fuse-linker-plugin -ffunction-sections -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 os:ubuntu-22.04-arm]) (push) Has been cancelled
C/C++ CI / build-windows-msys2 (map[c:gcc cxx:g++ flags:-ffunction-sections -Wno-error=maybe-uninitialized -Wno-error=attributes -Wno-attributes]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2022 rx:OFF tls:OFF upnp:OFF vs:Visual Studio 17 2022 vspath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2022 rx:OFF tls:ON upnp:OFF vs:Visual Studio 17 2022 vspath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2022 rx:OFF tls:ON upnp:ON vs:Visual Studio 17 2022 vspath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:OFF os:2022 rx:ON tls:ON upnp:ON vs:Visual Studio 17 2022 vspath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise]) (push) Has been cancelled
C/C++ CI / build-windows-msbuild (map[grpc:ON os:2022 rx:ON tls:ON upnp:ON vs:Visual Studio 17 2022 vspath:C:\Program Files\Microsoft Visual Studio\2022\Enterprise]) (push) Has been cancelled
C/C++ CI / build-macos (push) Has been cancelled
C/C++ CI / build-macos-aarch64 (push) Has been cancelled
C/C++ CI / build-freebsd (map[architecture:x86-64 host:ubuntu-latest name:freebsd version:13.3]) (push) Has been cancelled
C/C++ CI / build-openbsd (map[architecture:x86-64 host:ubuntu-latest name:openbsd version:7.4]) (push) Has been cancelled
C/C++ CI / build-ubuntu (map[c:gcc-12 cpp:g++-12 flags: os:ubuntu-22.04]) (push) Has been cancelled
C/C++ CI / build-windows-msys2 (map[c:clang cxx:clang++ flags:-fuse-ld=lld -Wno-unused-command-line-argument -Wno-nan-infinity-disabled -Wno-attributes]) (push) Has been cancelled
Microsoft C++ Code Analysis / Analyze (push) Has been cancelled
source-snapshot / source-snapshot (push) Has been cancelled
Sync test / sync-test-ubuntu-tsan (push) Has been cancelled
2026-04-25 10:25:48 +02:00
SChernykh 85750521bb TCPServer fixes 2026-04-24 23:30:37 +02:00
SChernykh 0255b801e5 CI: use macos-26 2026-04-24 19:37:01 +02:00
SChernykh fa53bdea55 More fixes and refactoring 2026-04-24 18:05:13 +02:00
SChernykh e1acf7b786 Fixed cppcheck error 2026-04-24 16:03:17 +02:00
SChernykh 54e0d3f3eb Refactored merge mining code 2026-04-24 11:01:59 +02:00
SChernykh eaee503d05 Updated dependencies 2026-04-20 11:21:59 +02:00
SChernykh 35f97b999c Build scripts: updated versions 2026-04-12 07:41:53 +02:00
SChernykh 44ea8e4557 CI: updated actions versions 2026-04-10 20:21:48 +02:00
SChernykh f3d97dc3d6 Fixed CI errors 2026-04-10 18:19:28 +02:00
SChernykh a32b4a6336 CI: use clang-22 2026-04-10 16:39:58 +02:00
jpk68 34f21e6236 Fixed for i2p 2026-03-13 16:12:03 +01:00
SChernykh 964e4a6163 Updated i2p seed node 2026-03-13 10:58:58 +01:00
SChernykh f1b2c3c51f Updated curl to 8.19.0 2026-03-11 10:03:02 +01:00
SChernykh b05361653e More cleanup and tests 2026-03-08 20:30:07 +01:00
SChernykh 0019d9ff0d Cleanup, compilation error fixes 2026-03-08 17:18:49 +01:00
jpk68 941e5114d8 Add I2P support 2026-03-08 16:50:02 +01:00
SChernykh bec1a56f7d Fix compile error 2026-03-07 20:43:44 +01:00
SChernykh dcfc64da42 Updated libuv to v1.52.1 2026-03-07 18:44:03 +01:00
SChernykh 9fee040ce0 p2pool v4.14 2026-03-01 10:01:44 +01:00
SChernykh ca39b36337 Stratum: reset workers counters on synchronized 2026-02-28 17:22:53 +01:00
SChernykh 7923f84233 Stratum: added sidechain/stratum shares display to workers command 2026-02-25 19:39:34 +01:00
SChernykh 7667f9d21e Refactored parameter parsing 2026-02-25 11:01:44 +01:00
SChernykh 0741ad1c07 Build scripts: updated versions 2026-02-25 07:32:34 +01:00
SChernykh f05ce6f697 Fixed SOCKS5 proxy detection
`std::stoul` can throw an exception, so don't use it.
2026-02-24 20:35:44 +01:00
KingJulien1st 23d3a24bc4 Add HAProxy PROXY Protocol v2 support (#399) 2026-02-22 22:17:32 +01:00
SChernykh 2cc5ba2fb9 CI: fixed msan build 2026-02-20 16:22:51 +01:00
SChernykh 93e3c07a18 Updated BoringSSL to v0.20260211.0 2026-02-17 12:08:35 +01:00
SChernykh 7f0be0bcf5 Updated RandomX 2026-02-15 14:06:31 +01:00
jpk68 f8310f27b8 Specify SOCKS5 proxy type in Tor docs 2026-02-12 22:13:56 +01:00
SChernykh 160ebd4289 Updated libuv to v1.52.0 2026-02-11 13:09:53 +01:00
SChernykh 6d6c12c1e8 Added SOCKS5 proxy type command line parameter
- Auto-detect by default, based on the port number
- Don't run TOR-specific code if it's not the TOR proxy
2026-02-10 21:32:01 +01:00
SChernykh cf1c88b907 Support IPv6 for ZMQ 2026-02-07 13:41:44 +01:00
SChernykh 6449a78863 Don't init gRPC if it's not used 2026-02-06 18:57:24 +01:00
SChernykh d966088470 Updated BoringSSL patch 2026-02-05 18:42:51 +01:00
SChernykh 5faec12678 Updated BoringSSL to v0.20260204.0 2026-02-05 17:18:36 +01:00
SChernykh 1bcddc8329 Build scripts: updated versions 2026-02-04 20:03:15 +01:00
SChernykh 0905b23123 Updated cppzmq and libzmq 2026-02-04 00:42:59 +01:00
SChernykh 64914566c0 Updated RandomX and miniupnp 2026-02-03 18:11:18 +01:00
SChernykh ab80f55698 Fixed whitespace 2026-01-26 22:47:17 +01:00
User0 31860f2e65 docs(root): fix note block about nano and mini in readme.md (#393) 2026-01-26 21:06:15 +01:00
jpk68 6e7311a83c Update docs (#392) 2026-01-24 13:36:20 +01:00
SChernykh e0a6daa5c7 Updated curl to 8.18.0 2026-01-07 16:37:27 +01:00
SChernykh 313fb64b41 Updated copyright 2026-01-01 22:13:05 +01:00
SChernykh 096e2e086b Updated DarkFi information 2025-12-29 19:15:41 +01:00
SChernykh d8ddaf80c8 p2pool v4.13 2025-12-18 12:26:42 +01:00
SChernykh 2dc091f3d4 Build scripts: updated versions 2025-12-17 20:42:15 +01:00
SChernykh 55cd2c9ae1 CI: disabled type sanitizer sync test 2025-12-16 22:17:29 +01:00
SChernykh 53cecac65b CI: added type sanitizer sync test 2025-12-16 19:19:54 +01:00
QuocViet Le d9de512b92 docs(nano): update documentation for nano (#386) 2025-12-11 20:17:49 +01:00
SChernykh 1bdf562967 Build scripts: updated versions 2025-12-07 20:12:17 +01:00
SChernykh d0daa6ec41 Sync test: ignore ZMQ reader errors 2025-12-05 21:20:25 +01:00
hinto-janai 1eb93fcd6b Edits to Gupax references (#387) 2025-12-02 10:22:34 +01:00
SChernykh 1cb4940960 Sync test: ignore node connection errors 2025-11-28 15:59:04 +01:00
SChernykh d5025965b4 Sync test: ignore random ZMQ disconnects 2025-11-25 18:17:33 +01:00
SChernykh 6aba1edaf8 Updated BoringSSL to v0.20251124.0 2025-11-25 11:36:15 +01:00
SChernykh 1166f31d07 RandomX: send seed when calling RPC (it's faster on monerod side) 2025-11-24 13:18:13 +01:00
SChernykh 3d2c9910f8 P2P: give peers from --addpeers a 2-second headstart before connecting to other peers 2025-11-22 13:24:03 +01:00
SChernykh 3584910baa Fixed reading the last line of config 2025-11-22 09:23:03 +01:00
SChernykh 8230040b76 Fixed CI errors 2025-11-21 21:20:20 +01:00
SChernykh de28201edc Added support for params config file 2025-11-21 20:13:13 +01:00
SChernykh d9cea1cfc3 Refactored command line parsing (part 2) 2025-11-21 18:15:57 +01:00
SChernykh 321d698be5 Refactored command line parsing 2025-11-21 13:22:39 +01:00
SChernykh 44a668cb15 Fixed onion connection counter 2025-11-20 17:19:40 +01:00
SChernykh 8151a5a537 Added --log-file command line parameter 2025-11-20 16:42:34 +01:00
SChernykh b81a582154 Build scripts: updated versions 2025-11-20 14:30:02 +01:00
SChernykh ee931ee178 Build scripts: updated clang to 21.1.6 2025-11-18 16:10:18 +01:00
SChernykh dbf0e58ee5 Build scripts: updated versions 2025-11-17 16:50:49 +01:00
SChernykh 86e9e90744 Updated BoringSSL patch 2025-11-12 13:21:08 +01:00
SChernykh dec45532f8 Updated BoringSSL to v0.20251110.0 2025-11-12 10:00:31 +01:00
119 changed files with 2790 additions and 1405 deletions
+42 -137
View File
@@ -36,7 +36,7 @@ jobs:
apk add git cmake gcc g++ make linux-headers xz
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -44,7 +44,7 @@ jobs:
shell: alpine.sh {0}
run: |
cd external/src/curl
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j$(nproc)
- name: Build libuv
@@ -53,7 +53,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DENABLE_CLANG_TIDY=OFF
make -j$(nproc)
- name: Build libzmq
@@ -104,7 +104,7 @@ jobs:
file p2pool
- name: Archive binary
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool-alpine-static-${{ matrix.config.arch }}
path: build/p2pool
@@ -132,7 +132,7 @@ jobs:
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev xz-utils ${{ matrix.config.c }} ${{ matrix.config.cpp }}
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -165,7 +165,7 @@ jobs:
./p2pool_tests
- name: Archive binary
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool-${{ matrix.config.os }}-${{ matrix.config.c }}
path: build/p2pool
@@ -189,14 +189,14 @@ jobs:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 --slave /usr/bin/g++ g++ /usr/bin/g++-12 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j$(nproc)
- name: Build libuv
@@ -204,7 +204,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DENABLE_CLANG_TIDY=OFF
make -j$(nproc)
- name: Build libzmq
@@ -244,7 +244,7 @@ jobs:
./p2pool_tests
- name: Archive binary
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool-ubuntu-static-libs
path: build/p2pool
@@ -266,14 +266,14 @@ jobs:
sudo apt install -y git build-essential cmake xz-utils
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j$(nproc)
- name: Build libuv
@@ -281,7 +281,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DENABLE_CLANG_TIDY=OFF
make -j$(nproc)
- name: Build libzmq
@@ -321,106 +321,11 @@ jobs:
./p2pool_tests
- name: Archive binary
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool-${{ matrix.config.os }}-aarch64
path: build/p2pool
build-ubuntu-riscv64:
timeout-minutes: 60
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {os: ubuntu-22.04, flags: "-fuse-linker-plugin -ffunction-sections"}
steps:
- name: Setup Alpine Linux
uses: jirutka/setup-alpine@v1
with:
arch: riscv64
branch: latest-stable
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y git build-essential cmake gcc-riscv64-linux-gnu g++-riscv64-linux-gnu binutils-riscv64-linux-gnu xz-utils
sudo cp /usr/riscv64-linux-gnu/lib/* /home/runner/rootfs/alpine-latest-riscv64/lib
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../../cmake/riscv64_toolchain.cmake -DCMAKE_C_FLAGS="-Os -flto=auto ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j$(nproc)
- name: Build libuv
run: |
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../../cmake/riscv64_toolchain.cmake -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
make -j$(nproc)
- name: Build libzmq
run: |
cd external/src/libzmq
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../../cmake/riscv64_toolchain.cmake -DCMAKE_C_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os -flto=auto ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc)
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../cmake/riscv64_toolchain.cmake -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=riscv64 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool
- name: Run self-test
shell: alpine.sh {0}
run: build/p2pool --test
- name: Build RandomX tests
run: |
cd build
make -j$(nproc) randomx-tests
- name: Run RandomX tests
shell: alpine.sh {0}
run: build/external/src/RandomX/randomx-tests
- name: Build tests
run: |
cd tests
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../cmake/riscv64_toolchain.cmake -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=riscv64 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool_tests
- name: Prepare test data
run: |
cd tests/build
unxz *.xz
- name: Run tests
shell: alpine.sh {0}
run: |
cd tests/build
./p2pool_tests
- name: Archive binary
uses: actions/upload-artifact@v4
with:
name: p2pool-${{ matrix.config.os }}-riscv64
path: build/p2pool
build-windows-msys2:
timeout-minutes: 60
@@ -438,7 +343,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -455,7 +360,7 @@ jobs:
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_C_FLAGS="-Os ${{ matrix.config.flags }}" -DCURL_TARGET_WINDOWS_VERSION=0x0600 -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_C_FLAGS="-Os ${{ matrix.config.flags }}" -DCURL_TARGET_WINDOWS_VERSION=0x0600 -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j$(nproc)
- name: Build libuv
@@ -463,7 +368,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DENABLE_CLANG_TIDY=OFF
make -j$(nproc)
- name: Build libzmq
@@ -503,7 +408,7 @@ jobs:
./p2pool_tests.exe
- name: Archive binary
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool-msys2-${{ matrix.config.c }}.exe
path: build/p2pool.exe
@@ -524,7 +429,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -575,7 +480,7 @@ jobs:
p2pool_tests.exe
- name: Archive binary
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool-vs-${{ matrix.config.os }}-randomx-${{ matrix.config.rx }}-upnp-${{ matrix.config.upnp }}-grpc-${{ matrix.config.grpc }}-tls-${{ matrix.config.tls }}.exe
path: build/Release/p2pool.exe
@@ -583,18 +488,18 @@ jobs:
build-macos:
timeout-minutes: 90
runs-on: macos-15-intel
runs-on: macos-26-intel
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@18)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@18)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@18)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option" -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j4
- name: Build libuv
@@ -602,7 +507,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@18)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@18)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@18)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DENABLE_CLANG_TIDY=OFF
make -j4
- name: Build libzmq
@@ -610,14 +515,14 @@ jobs:
cd external/src/libzmq
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@18)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@18)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@18)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@18)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-Os -flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
make -j4
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@18)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@18)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@18)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@18)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_ASM_FLAGS='-target x86_64-apple-macos10.13' -DSTATIC_LIBS=ON
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_ASM_FLAGS='-target x86_64-apple-macos10.13' -DSTATIC_LIBS=ON
make -j4 p2pool
- name: Run RandomX tests
@@ -632,7 +537,7 @@ jobs:
cd tests
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@18)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@18)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@18)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@18)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_ASM_FLAGS='-target x86_64-apple-macos10.13' -DSTATIC_LIBS=ON
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_CXX_FLAGS='-flto -target x86_64-apple-macos10.13 -Wno-overriding-t-option' -DCMAKE_ASM_FLAGS='-target x86_64-apple-macos10.13' -DSTATIC_LIBS=ON
make -j4 p2pool_tests
- name: Run tests
@@ -642,7 +547,7 @@ jobs:
./p2pool_tests
- name: Archive binary
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool-macos
path: build/p2pool
@@ -650,18 +555,18 @@ jobs:
build-macos-aarch64:
timeout-minutes: 30
runs-on: macos-15
runs-on: macos-26
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@18)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@18)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@18)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-Os -target arm64-apple-macos-11" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-Os -target arm64-apple-macos-11" -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j3
- name: Build libuv
@@ -669,7 +574,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@18)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@18)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@18)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -target arm64-apple-macos-11' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -target arm64-apple-macos-11' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DENABLE_CLANG_TIDY=OFF
make -j3
- name: Build libzmq
@@ -677,14 +582,14 @@ jobs:
cd external/src/libzmq
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@18)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@18)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@18)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@18)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -target arm64-apple-macos-11' -DCMAKE_CXX_FLAGS='-Os -target arm64-apple-macos-11' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='-Os -target arm64-apple-macos-11' -DCMAKE_CXX_FLAGS='-Os -target arm64-apple-macos-11' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
make -j3
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@18)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@18)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@18)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@18)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-target arm64-apple-macos-11" -DCMAKE_CXX_FLAGS="-target arm64-apple-macos-11" -DSTATIC_LIBS=ON -DWITH_LTO=OFF -DARCH_ID=aarch64
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-target arm64-apple-macos-11" -DCMAKE_CXX_FLAGS="-target arm64-apple-macos-11" -DSTATIC_LIBS=ON -DWITH_LTO=OFF -DARCH_ID=aarch64
make -j3 p2pool
- name: Run RandomX tests
@@ -699,7 +604,7 @@ jobs:
cd tests
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@18)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@18)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@18)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@18)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-target arm64-apple-macos-11" -DCMAKE_CXX_FLAGS="-target arm64-apple-macos-11" -DSTATIC_LIBS=ON -DWITH_LTO=OFF -DARCH_ID=aarch64
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="-target arm64-apple-macos-11" -DCMAKE_CXX_FLAGS="-target arm64-apple-macos-11" -DSTATIC_LIBS=ON -DWITH_LTO=OFF -DARCH_ID=aarch64
make -j3 p2pool_tests
- name: Run tests
@@ -709,7 +614,7 @@ jobs:
./p2pool_tests
- name: Archive binary
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool-macos-aarch64
path: build/p2pool
@@ -729,7 +634,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -750,12 +655,12 @@ jobs:
run: |
sudo pkg install -y cmake
cd external/src/curl
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Os -flto" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Os -flto" -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j4
cd ../libuv
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DENABLE_CLANG_TIDY=OFF
make -j4
cd ../../libzmq
mkdir build
@@ -779,7 +684,7 @@ jobs:
./p2pool_tests
- name: Archive binary
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool-${{ matrix.os.name }}-${{ matrix.os.version }}
path: build/p2pool
@@ -799,7 +704,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -830,7 +735,7 @@ jobs:
./p2pool_tests
- name: Archive binary
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool-${{ matrix.os.name }}-${{ matrix.os.version }}
path: build/p2pool
+6 -6
View File
@@ -19,12 +19,12 @@ jobs:
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 21
sudo apt-get install -y clang-tidy-21
clang-tidy-21 --verify-config
sudo ./llvm.sh 22
sudo apt-get install -y clang-tidy-22
clang-tidy-22 --verify-config
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -32,9 +32,9 @@ jobs:
run: |
mkdir build
cd build
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-21 -DCMAKE_CXX_COMPILER=clang++-21 -DDEV_CLANG_TIDY=ON -DSTATIC_LIBS=ON -DWITH_INDEXED_HASHES=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-22 -DCMAKE_CXX_COMPILER=clang++-22 -DDEV_CLANG_TIDY=ON -DSTATIC_LIBS=ON -DWITH_INDEXED_HASHES=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
- name: Run clang-tidy
run: |
cd src
clang-tidy-21 *.cpp -p ../build -checks=bugprone-*,clang-analyzer-*,llvm-*,cppcoreguidelines-pro-type-const-cast,cppcoreguidelines-pro-type-cstyle-cast,cppcoreguidelines-rvalue-reference-param-not-moved,hicpp-use-emplace,hicpp-use-override,-bugprone-easily-swappable-parameters,-bugprone-empty-catch,-llvm-include-order -warnings-as-errors=* -header-filter=^[^\./]
clang-tidy-22 *.cpp -p ../build -checks=bugprone-*,clang-analyzer-*,llvm-*,cppcoreguidelines-pro-type-const-cast,cppcoreguidelines-pro-type-cstyle-cast,cppcoreguidelines-rvalue-reference-param-not-moved,hicpp-use-emplace,hicpp-use-override,-bugprone-easily-swappable-parameters,-bugprone-empty-catch,-llvm-include-order,-bugprone-random-generator-seed,-llvm-use-ranges,-bugprone-throwing-static-initialization -warnings-as-errors=* -header-filter=^[^\./]
+3 -3
View File
@@ -48,13 +48,13 @@ jobs:
sudo apt update && sudo apt install git build-essential cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -71,4 +71,4 @@ jobs:
make -j$(nproc) p2pool
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v4
+7 -7
View File
@@ -26,10 +26,10 @@ jobs:
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 21 all
sudo ./llvm.sh 22 all
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -38,7 +38,7 @@ jobs:
cd tests
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DDEV_DEBUG=ON -DWITH_INDEXED_HASHES=ON -DWITH_COVERAGE=ON -DCMAKE_C_COMPILER=clang-21 -DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
cmake .. -DCMAKE_BUILD_TYPE=Release -DDEV_DEBUG=ON -DWITH_INDEXED_HASHES=ON -DWITH_COVERAGE=ON -DCMAKE_C_COMPILER=clang-22 -DCMAKE_CXX_COMPILER=clang++-22 -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool_tests
- name: Run tests
@@ -50,12 +50,12 @@ jobs:
- name: Merge profile data
run: |
cd tests/build
llvm-profdata-21 merge -sparse ./p2pool_tests.profraw -o ./p2pool_tests.profdata
llvm-profdata-22 merge -sparse ./p2pool_tests.profraw -o ./p2pool_tests.profdata
- name: Export profile data
run: |
cd tests/build
llvm-cov-21 export ./p2pool_tests -format=lcov -instr-profile=./p2pool_tests.profdata > coverage.info
llvm-cov-22 export ./p2pool_tests -format=lcov -instr-profile=./p2pool_tests.profdata > coverage.info
- name: Run genhtml
run: |
@@ -63,7 +63,7 @@ jobs:
genhtml --demangle-cpp -o coverage coverage.info
- name: Checkout GitHub Pages repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
repository: SChernykh/SChernykh.github.io
token: ${{ secrets.PAGES_DEPLOY_TOKEN }}
@@ -85,7 +85,7 @@ jobs:
- name: Archive coverage data
if: '!cancelled()'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool-coverage
path: tests/build/coverage
+6 -6
View File
@@ -21,7 +21,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -48,14 +48,14 @@ jobs:
- name: Archive full error list
if: '!cancelled()'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: errors_full-linux
path: cppcheck/errors_full.txt
- name: Archive checkers report
if: '!cancelled()'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: checkers_report-linux
path: cppcheck/checkers_report.txt
@@ -67,7 +67,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -96,14 +96,14 @@ jobs:
- name: Archive full error list
if: '!cancelled()'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: errors_full-windows
path: cppcheck/errors_full.txt
- name: Archive checkers report
if: '!cancelled()'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: checkers_report-windows
path: cppcheck/checkers_report.txt
+7 -3
View File
@@ -31,10 +31,14 @@ jobs:
name: Analyze
timeout-minutes: 240
runs-on: windows-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -58,13 +62,13 @@ jobs:
# Upload SARIF file to GitHub Code Scanning Alerts
- name: Upload SARIF to GitHub
uses: github/codeql-action/upload-sarif@v3
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: ${{ steps.run-analysis.outputs.sarif }}
# Upload SARIF file as an Artifact to download and view
- name: Upload SARIF as an Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: sarif-file
path: ${{ steps.run-analysis.outputs.sarif }}
+2 -2
View File
@@ -12,7 +12,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -22,7 +22,7 @@ jobs:
XZ_OPT=-e9 tar --exclude=".git" --exclude="build" -f build/p2pool_source.tar.xz -c ../p2pool --xz
- name: Archive source code
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool_source.tar.xz
path: build/p2pool_source.tar.xz
+88 -30
View File
@@ -27,14 +27,14 @@ jobs:
sudo apt install -y git build-essential cmake gcc-12 g++-12
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j$(nproc)
- name: Build libuv
@@ -42,7 +42,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_C_COMPILER=gcc-12 -DCMAKE_C_FLAGS='-fsanitize=thread -Og -fno-omit-frame-pointer -g' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DENABLE_CLANG_TIDY=OFF
make -j$(nproc)
- name: Build libzmq
@@ -82,7 +82,7 @@ jobs:
- name: Archive p2pool.log
if: '!cancelled()'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool_ubuntu_data_tsan
path: |
@@ -91,7 +91,7 @@ jobs:
sync-test-ubuntu-msan:
timeout-minutes: 60
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- name: Install dependencies
@@ -103,14 +103,14 @@ jobs:
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 21 all
sudo ./llvm.sh 22 all
- name: Build libcxx_msan
run: |
git clone --depth=1 https://github.com/llvm/llvm-project -b release/21.x
git clone --depth=1 https://github.com/llvm/llvm-project -b release/22.x
cd llvm-project
mkdir build
cmake -G Ninja -S runtimes -B build -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" -DCMAKE_C_COMPILER=clang-21 -DCMAKE_CXX_COMPILER=clang++-21 -DLLVM_USE_SANITIZER=MemoryWithOrigins -DLIBCXXABI_USE_LLVM_UNWINDER=OFF
cmake -G Ninja -S runtimes -B build -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" -DCMAKE_C_COMPILER=clang-22 -DCMAKE_CXX_COMPILER=clang++-22 -DLLVM_USE_SANITIZER=MemoryWithOrigins -DLIBCXXABI_USE_LLVM_UNWINDER=OFF
ninja -C build cxx cxxabi
cd build
mkdir /tmp/libcxx_msan
@@ -118,14 +118,14 @@ jobs:
cp -r lib /tmp/libcxx_msan
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-21 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -O0 -fno-omit-frame-pointer -g3' -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-22 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -O0 -fno-omit-frame-pointer -g3' -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j$(nproc)
- name: Build libuv
@@ -133,7 +133,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-21 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -O0 -fno-omit-frame-pointer -g3' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-22 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -O0 -fno-omit-frame-pointer -g3' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DENABLE_CLANG_TIDY=OFF
make -j$(nproc)
- name: Build libzmq
@@ -141,14 +141,14 @@ jobs:
cd external/src/libzmq
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-21 -DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -O0 -fno-omit-frame-pointer -g3' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -isystem /tmp/libcxx_msan/include/c++/v1 -O0 -fno-omit-frame-pointer -g3' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-22 -DCMAKE_CXX_COMPILER=clang++-22 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -O0 -fno-omit-frame-pointer -g3' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -isystem /tmp/libcxx_msan/include/c++/v1 -O0 -fno-omit-frame-pointer -g3' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc)
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-21 -DCMAKE_CXX_COMPILER=clang++-21 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -fno-omit-frame-pointer' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -isystem /tmp/libcxx_msan/include/c++/v1 -L/tmp/libcxx_msan/lib -Wl,-rpath /tmp/libcxx_msan/lib -lc++ -lc++abi -Wno-unused-command-line-argument -fuse-ld=lld-21 -fno-omit-frame-pointer' -DDEV_TEST_SYNC=ON -DDEV_WITH_MSAN=ON -DWITH_LTO=OFF -DSTATIC_LIBS=ON -DWITH_INDEXED_HASHES=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-22 -DCMAKE_CXX_COMPILER=clang++-22 -DCMAKE_C_FLAGS='-fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -fno-omit-frame-pointer' -DCMAKE_CXX_FLAGS='-nostdinc++ -nostdlib++ -fsanitize=memory -fsanitize-recover -fsanitize-memory-track-origins -isystem /tmp/libcxx_msan/include/c++/v1 -L/tmp/libcxx_msan/lib -Wl,-rpath /tmp/libcxx_msan/lib -lc++ -lc++abi -Wno-unused-command-line-argument -fuse-ld=lld-22 -fno-omit-frame-pointer' -DDEV_TEST_SYNC=ON -DDEV_WITH_MSAN=ON -DWITH_LTO=OFF -DSTATIC_LIBS=ON -DWITH_INDEXED_HASHES=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool
- name: Run p2pool
@@ -173,7 +173,7 @@ jobs:
- name: Archive p2pool.log
if: '!cancelled()'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool_ubuntu_data_msan
path: |
@@ -193,7 +193,7 @@ jobs:
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev gcc-12 g++-12
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -226,7 +226,7 @@ jobs:
- name: Archive p2pool.log
if: '!cancelled()'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool_ubuntu_data_ubsan
path: |
@@ -246,7 +246,7 @@ jobs:
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev gcc-12 g++-12
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -279,13 +279,71 @@ jobs:
- name: Archive p2pool.log
if: '!cancelled()'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool_ubuntu_data_asan
path: |
build/*.log
build/data/
sync-test-ubuntu-tysan:
if: false # disabled because it generates a flood of type aliasing errors
timeout-minutes: 60
runs-on: ubuntu-22.04
steps:
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y git build-essential cmake libuv1-dev libzmq3-dev libgss-dev libcurl4-openssl-dev libidn2-0-dev
- name: Install clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 22 all
- name: Checkout repository
uses: actions/checkout@v6
with:
submodules: recursive
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-22 -DCMAKE_CXX_COMPILER=clang++-22 -DDEV_TEST_SYNC=ON -DDEV_DEBUG=ON -DDEV_WITH_TYSAN=ON -DWITH_LTO=OFF -DWITH_INDEXED_HASHES=ON -DCMAKE_POLICY_VERSION_MINIMUM="3.5"
make -j$(nproc) p2pool
- name: Run p2pool
run: |
cd build
mkdir data
python ../tests/src/stratum_dummy.py 1 &
python ../tests/src/stratum_dummy.py 2 &
python ../tests/src/stratum_dummy.py 3 &
sudo sysctl vm.mmap_rnd_bits=28
TYSAN_OPTIONS=print_stacktrace=1 ./p2pool --host node.monerodevs.org --rpc-port 18089 --zmq-port 18084 --host node.richfowler.net --rpc-port 18089 --zmq-port 18084 --rpc-ssl --wallet 44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg ${{ secrets.MM_PARAMS }} --out-peers 50 --data-api data --local-api --loglevel 6 --light-mode 2> stderr.log
- name: Check synchronization
run: |
cd build
grep 'Synchronization finished successfully' p2pool.log
- name: Check p2pool.log for errors
run: |
cd build
../scripts/workflows/test-sync-check.sh
- name: Archive p2pool.log
if: '!cancelled()'
uses: actions/upload-artifact@v7
with:
name: p2pool_ubuntu_data_tysan
path: |
build/*.log
build/data/
sync-test-macos:
timeout-minutes: 120
@@ -294,19 +352,19 @@ jobs:
strategy:
matrix:
config:
- {os: macos-15-intel, flags: ""}
- {os: macos-15, flags: "-target arm64-apple-macos-11"}
- {os: macos-26-intel, flags: ""}
- {os: macos-26, flags: "-target arm64-apple-macos-11"}
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_C_COMPILER="$(brew --prefix llvm@18)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@18)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@18)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DCURL_DISABLE_TESTS=ON -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS="${{ matrix.config.flags }}" -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j4
- name: Build libuv
@@ -314,7 +372,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@18)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@18)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@18)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF -DENABLE_CLANG_TIDY=OFF
make -j4
- name: Build libzmq
@@ -322,14 +380,14 @@ jobs:
cd external/src/libzmq
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@18)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@18)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@18)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@18)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
make -j4
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@18)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@18)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@18)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@18)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}' -DWITH_LTO=OFF -DSTATIC_LIBS=ON -DDEV_TEST_SYNC=ON -DDEV_DEBUG=ON -DWITH_INDEXED_HASHES=ON
cmake .. -DCMAKE_C_COMPILER="$(brew --prefix llvm@20)/bin/clang" -DCMAKE_CXX_COMPILER="$(brew --prefix llvm@20)/bin/clang++" -DCMAKE_AR="$(brew --prefix llvm@20)/bin/llvm-ar" -DCMAKE_RANLIB="$(brew --prefix llvm@20)/bin/llvm-ranlib" -DCMAKE_C_FLAGS='${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }}' -DWITH_LTO=OFF -DSTATIC_LIBS=ON -DDEV_TEST_SYNC=ON -DDEV_DEBUG=ON -DWITH_INDEXED_HASHES=ON
make -j4 p2pool
- name: Run p2pool
@@ -353,7 +411,7 @@ jobs:
- name: Archive p2pool.log
if: '!cancelled()'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool_${{ matrix.config.os }}_data
path: |
@@ -367,7 +425,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -399,7 +457,7 @@ jobs:
- name: Archive p2pool.log
if: '!cancelled()'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool_windows_data_debug_asan
path: |
@@ -413,7 +471,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
submodules: recursive
@@ -444,7 +502,7 @@ jobs:
- name: Archive p2pool.log
if: '!cancelled()'
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: p2pool_windows_data_leaks
path: |
+3
View File
@@ -27,6 +27,7 @@ option(DEV_WITH_TSAN "[Developer only] Compile with thread sanitizer" OFF)
option(DEV_WITH_MSAN "[Developer only] Compile with memory sanitizer" OFF)
option(DEV_WITH_UBSAN "[Developer only] Compile with undefined behavior sanitizer" OFF)
option(DEV_WITH_ASAN "[Developer only] Compile with address sanitizer" OFF)
option(DEV_WITH_TYSAN "[Developer only] Compile with type sanitizer" OFF)
option(DEV_CLANG_TIDY "[Developer only] Compile for clang-tidy" OFF)
option(DEV_TRACK_MEMORY "[Developer only] Track memory allocations" OFF)
option(DEV_DEBUG "[Developer only] Compile a debug build" OFF)
@@ -130,6 +131,7 @@ set(HEADERS
src/uv_util.h
src/wallet.h
src/zmq_reader.h
src/i2p.h
)
set(SOURCES
@@ -163,6 +165,7 @@ set(SOURCES
src/util.cpp
src/wallet.cpp
src/zmq_reader.cpp
src/i2p.cpp
)
if (AMD64)
+34 -25
View File
@@ -2,7 +2,13 @@
Decentralized pool for Monero mining.
Pool status and monitoring pages can be found at https://p2pool.io/, https://p2pool.io/mini/ and https://p2pool.observer/, https://mini.p2pool.observer/
Pool status and monitoring pages can be found at:
|P2Pool||
|-|-|
|main|https://p2pool.io/ <br> https://p2pool.observer/|
|mini|https://p2pool.io/mini/ <br> https://mini.p2pool.observer/|
|nano|https://p2pool.io/nano/ <br> https://nano.p2pool.observer/|
These are 3rd-party pages. If they are down, it doesn't mean there is a problem with P2Pool itself - it keeps mining always thanks to its decentralized nature.
@@ -60,7 +66,7 @@ Here's the comparison table of the different ways of mining. While pool mining i
* Advanced mempool picking algorithm, it creates blocks with better reward than what monerod solo mining does
* Password protected private pools
* Highly reliable configurations are supported (multiple P2Pool nodes mining to the same wallet, each P2Pool node can use multiple Monero nodes and switch on the fly if an issue is detected)
* Mining through [TOR](docs/TOR.MD) is fully supported
* Mining through [TOR](docs/TOR.MD) and [I2P](docs/I2P.MD) are fully supported
## How payouts work in P2Pool
@@ -90,12 +96,16 @@ In order to continue mining on P2Pool, you must update both Monero and P2Pool so
### General Considerations
- In order to mine on P2Pool, a synced Monero node using monerod v0.18.0.0 or newer is required. If you don't currently have one, you can download the [official Monero binaries](https://www.getmonero.org/downloads/), start `monerod` on your PC and wait until it's fully synced. Advanced Monero node setup instructions are [here](https://sethforprivacy.com/guides/run-a-monero-node-advanced/).
- It is highly recommended that you create a separate restricted user account (in your OS) for mining. While P2Pool has been battle-tested for a long time now, any software may have unknown bugs/vulnerabilities.
- It is highly recommended that you create a separate restricted user account (in your OS) for mining. While P2Pool has been battle-tested for a long time now, any software may have unknown bugs/vulnerabilities.
- You can mine to a primary wallet address (the one starting with `4`) for mining. If you want to mine to a subaddress, you will need to provide both the main address (starting with 4) and the subaddress (starting with 8) using `--wallet` and `--subaddress` command line parameters.
- You can add the `--mini` parameter to your P2Pool command to connect to the **p2pool-mini** sidechain. Note that it will also change the default p2p port from 37889 to 37888.
- Check that ports 18080 (Monero p2p port) and 37889/37888 (P2Pool/P2Pool mini p2p port) are open in your firewall to ensure better connectivity. If you're mining from a computer behind NAT (like a router) you could consider forwarding the ports to your local machine.
- You can add the `--mini` or `--nano` parameter to your P2Pool command to connect to the respective sidechain.
> [!NOTE]
> You cannot use both `--mini` and `--nano` together<br>
> Using `--mini` will change the p2p port to 37888.<br>
> Using `--nano` will change the p2p port to 37890.<br>
- Check that ports 18080 (Monero p2p port) and 37889/37888/37890 (P2Pool default/mini/nano p2p port) are open in your firewall to ensure better connectivity. If you're mining from a computer behind NAT (like a router) you could consider forwarding the ports to your local machine.
- You can connect multiple miners to the same P2Pool node. The more the better!
- The steps below assume that you run everything on the same machine. If it's not the case, change `127.0.0.1` to appropriate IP addresses for your setup.
- The steps below assume that you run everything on the same machine. If it's not the case, change `127.0.0.1` to appropriate IP addresses for your setup.
- It is highly recommended to create a new mainnet wallet for P2Pool mining because **wallet addresses are public on P2Pool**.
**Wallet software compatible with P2Pool payouts**
@@ -104,11 +114,10 @@ In order to continue mining on P2Pool, you must update both Monero and P2Pool so
- [Cake Wallet v4.4.5 and newer](https://cakewallet.com/)
- [Monero.com by Cake Wallet](https://monero.com/)
- [Feather Wallet v2.1.0 and newer](https://featherwallet.org/)
- [MyMonero](https://mymonero.com/)
### GUI for P2Pool
- [Gupax](https://github.com/hinto-janai/gupax) project aims to provide an easy to use cross-platform GUI to configure and run P2Pool & [XMRig](https://github.com/xmrig/xmrig).
- [Gupax](https://github.com/gupax-io/gupax) project aims to provide an easy to use cross-platform GUI to configure and run P2Pool & [XMRig](https://github.com/xmrig/xmrig).
### Merge mining
@@ -116,7 +125,7 @@ Merge mining is available in P2Pool since the fork that happened on October 12th
Blockchains that will support [Merge mining RPC API](https://github.com/SChernykh/p2pool/blob/master/docs/MERGE_MINING.MD#proposed-rpc-api):
- [Townforge](https://townforge.net/) supports it in their [tmp-mm branch](https://git.townforge.net/townforge/townforge/src/branch/tmp-mm) (not released yet)
- [DarkFi](https://dark.fi/) is going to support it, but it's [not ready yet](https://github.com/darkrenaissance/darkfi/issues/244)
- [DarkFi](https://dark.fi/) supports it in their [testnet](https://dark.fi/book/testnet/merge-mining.html)
```
p2pool.exe --wallet YOUR_MONERO_WALLET_ADDRESS --merge-mine IP:port YOUR_WALLET_ADDRESS_ON_ANOTHER_BLOCKCHAIN
```
@@ -148,15 +157,15 @@ Note that Tari will be mined in solo mode (only full Tari blocks can be mined fo
1. Download the latest P2Pool binaries [here](https://github.com/SChernykh/p2pool/releases/latest).
- Alternatively, grab the latest source code for P2Pool and [build it](#build-instructions).
2. Download the latest XMRig (linux-static-x64) binary [here](https://github.com/xmrig/xmrig/releases/latest).
3. Prepare enough huge pages (each of monerod/P2Pool/XMRig needs them):
3. Prepare enough huge pages (each of monerod/P2Pool/XMRig needs them):
```
sudo sysctl vm.nr_hugepages=3072
```
4. Check that ports 18080 (Monero p2p port) and 37889/37888 (P2Pool/P2Pool mini p2p port) are open in your local firewall to ensure better connectivity.
5. Start `monerod` with the following command/options:
4. Check that ports 18080 (Monero p2p port) and 37889/37888/37890 (P2Pool default/mini/nano p2p port) are open in your local firewall to ensure better connectivity.
5. Start `monerod` with the following command/options:
```
./monerod --zmq-pub tcp://127.0.0.1:18083 --out-peers 32 --in-peers 64 --add-priority-node=p2pmd.xmrvsbeast.com:18080 --add-priority-node=nodes.hashvault.pro:18080 --enforce-dns-checkpointing --enable-dns-blocklist
```
```
**Note:**
The `--zmq-pub` option is required for P2Pool to work properly.
@@ -178,16 +187,16 @@ The `--zmq-pub` option is required for P2Pool to work properly.
```
./xmrig -o 127.0.0.1:3333
```
- Note that you don't need to specify your wallet address for XMRig. **Wallet addresses set in XMRig config will be ignored!**
- To set a custom fixed difficulty for your miner (for example, 10000), instead start XMRig with the following options:
- Note that you don't need to specify your wallet address for XMRig. **Wallet addresses set in XMRig config will be ignored!**
- To set a custom fixed difficulty for your miner (for example, 10000), instead start XMRig with the following options:
```
./xmrig -u x+10000 -o 127.0.0.1:3333
```
9. XMRig should connect and start mining!
**Additional Information:**
**Additional Information:**
- For a more in-depth beginner friendly walk-through with the option of using Docker, please see SethForPrivacy's guide at: https://sethforprivacy.com/guides/run-a-p2pool-node/
- You can check the p2pool.log for any warnings or errors using the following command:
- You can check the p2pool.log for any warnings or errors using the following command:
```
grep -E 'WARNING|ERROR' p2pool.log
```
@@ -204,7 +213,7 @@ nocreate
}
```
### Windows
### Windows
**Note:** *Windows SmartScreen may block incoming connections by files that are "Downloaded from the Internet". You can allow 'p2pool.exe' and 'monerod.exe' by double-clicking them, clicking "More Info", then click "Run Anyway" and then closing them immediately so you can run them from the command line. Advanced users can use the PowerShell cmdlet `Unblock-File` to remove this flag.*
@@ -212,8 +221,8 @@ nocreate
- Alternatively, grab the latest source code for P2Pool and [build it](#build-instructions).
2. Download the latest XMRig binary [here](https://github.com/xmrig/xmrig/releases/latest).
3. Expand the P2Pool binaries into an appropriate location (`%USERPROFILE%/bin` or `C:/bin/` are good options)
4. Expand XMRig binary into an appropriate location (the same folder as P2Pool is fine).
5. Prepare huge pages to work properly (each of monerod/P2Pool/XMRig needs them):
4. Expand XMRig binary into an appropriate location (the same folder as P2Pool is fine).
5. Prepare huge pages to work properly (each of monerod/P2Pool/XMRig needs them):
- On Windows 10 or above, run XMRig at least once as Administrator (right-click Run As Administrator)
- On earlier versions of Windows, you'll need to run XMRig as Administrator at least once per login.
6. Create "Monero" folder inside extracted P2Pool folder and copy Monero binaries there.
@@ -221,7 +230,7 @@ nocreate
**Note:** *When running the below commands, Windows Firewall may prompt to allow connections, click "Allow" if prompted.*
8. Start `monerod` with the following command/options:
8. Start `monerod` with the following command/options:
```
.\Monero\monerod.exe --zmq-pub tcp://127.0.0.1:18083 --out-peers 32 --in-peers 64 --add-priority-node=p2pmd.xmrvsbeast.com:18080 --add-priority-node=nodes.hashvault.pro:18080 --enforce-dns-checkpointing --enable-dns-blocklist
```
@@ -245,8 +254,8 @@ The `--zmq-pub` option is required for P2Pool to work properly.
```
.\xmrig.exe -o 127.0.0.1:3333
```
- Note that you don't need to specify your wallet address for XMRig. **Wallet addresses set in XMRig config will be ignored!**
- To set a custom fixed difficulty for your miner (for example, 10000), instead start XMRig with the following options:
- Note that you don't need to specify your wallet address for XMRig. **Wallet addresses set in XMRig config will be ignored!**
- To set a custom fixed difficulty for your miner (for example, 10000), instead start XMRig with the following options:
```
xmrig.exe -u x+10000 -o 127.0.0.1:3333
```
@@ -290,7 +299,7 @@ pacman -S p2pool
### [Nix/NixOS](https://nixos.org)
This is a flake only project. So you have to use [nixUnstable with nix flakes](https://nixos.wiki/wiki/Flakes) to build or install P2Pool.
This is a flake only project. So you have to use [nixUnstable with nix flakes](https://nixos.wiki/wiki/Flakes) to build or install P2Pool.
The commands below use the new flake specific reference-format, so be sure to also set `ca-references` in `--experimental-features`.
Because this project has submodules which are not fixed in _nixUnstable_ yet you have to use the `nix/master` branch:
@@ -321,7 +330,7 @@ cmake .. -G "Visual Studio 16 2019"
```
then open generated build\p2pool.sln in Visual Studio and build it there
Alternatively, you can select "Clone a repository" within the GUI, then select "Build" from the menu.
Alternatively, you can select "Clone a repository" within the GUI, then select "Build" from the menu.
### macOS
+5 -1
View File
@@ -113,6 +113,10 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
set(GENERAL_FLAGS "${GENERAL_FLAGS} -mfix-cortex-a53-835769")
endif()
if (DEV_WITH_TYSAN)
set(GENERAL_FLAGS "${GENERAL_FLAGS} -fno-omit-frame-pointer -fsanitize=type")
endif()
set(WARNING_FLAGS "-Wall -Wextra -Wno-unused-function -Wno-undefined-internal -Wno-unknown-warning-option -Wno-nan-infinity-disabled -Wunreachable-code-aggressive -Wmissing-prototypes -Wmissing-variable-declarations -Werror")
if (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 20))
@@ -123,7 +127,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
set(WARNING_FLAGS "-w")
endif()
if (DEV_WITH_MSAN OR DEV_DEBUG OR (CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
if (DEV_WITH_MSAN OR DEV_WITH_TYSAN OR DEV_DEBUG OR (CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
add_definitions(-DDEBUG_BUILD)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(OPTIMIZATION_FLAGS "-O0")
+4 -4
View File
@@ -3,7 +3,7 @@ set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_C_COMPILER /usr/local/bin/aarch64-apple-darwin25-clang)
set(CMAKE_CXX_COMPILER /usr/local/bin/aarch64-apple-darwin25-clang++)
set(CMAKE_ASM_COMPILER /usr/local/bin/aarch64-apple-darwin25-as)
set(CMAKE_STRIP /usr/local/bin/aarch64-apple-darwin25-strip)
set(CMAKE_C_COMPILER /usr/local/bin/aarch64-apple-darwin25.1-clang)
set(CMAKE_CXX_COMPILER /usr/local/bin/aarch64-apple-darwin25.1-clang++)
set(CMAKE_ASM_COMPILER /usr/local/bin/aarch64-apple-darwin25.1-as)
set(CMAKE_STRIP /usr/local/bin/aarch64-apple-darwin25.1-strip)
+4 -4
View File
@@ -3,7 +3,7 @@ set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(CMAKE_C_COMPILER /usr/local/bin/x86_64-apple-darwin25-clang)
set(CMAKE_CXX_COMPILER /usr/local/bin/x86_64-apple-darwin25-clang++)
set(CMAKE_ASM_COMPILER /usr/local/bin/x86_64-apple-darwin25-as)
set(CMAKE_STRIP /usr/local/bin/x86_64-apple-darwin25-strip)
set(CMAKE_C_COMPILER /usr/local/bin/x86_64-apple-darwin25.1-clang)
set(CMAKE_CXX_COMPILER /usr/local/bin/x86_64-apple-darwin25.1-clang++)
set(CMAKE_ASM_COMPILER /usr/local/bin/x86_64-apple-darwin25.1-as)
set(CMAKE_STRIP /usr/local/bin/x86_64-apple-darwin25.1-strip)
+5 -2
View File
@@ -15,6 +15,11 @@ set(BUILD_SHARED OFF CACHE BOOL "")
set(ENABLE_CLANG OFF CACHE BOOL "")
set(CURL_TARGET_WINDOWS_VERSION "0x0600" CACHE STRING "")
set(CURL_DROP_UNUSED ON CACHE BOOL "")
set(CURL_DISABLE_TYPECHECK ON CACHE BOOL "")
set(CURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG ON CACHE BOOL "")
set(CURL_DISABLE_SHA512_256 ON CACHE BOOL "")
set(PICKY_COMPILER OFF CACHE BOOL "")
set(BUILD_CURL_EXE OFF CACHE BOOL "")
set(BUILD_SHARED_LIBS OFF CACHE BOOL "")
set(CURL_DISABLE_INSTALL ON CACHE BOOL "")
@@ -39,9 +44,7 @@ set(CURL_DISABLE_NTLM ON CACHE BOOL "")
set(CURL_DISABLE_PARSEDATE ON CACHE BOOL "")
set(CURL_DISABLE_PROGRESS_METER ON CACHE BOOL "")
set(CURL_DISABLE_SHUFFLE_DNS ON CACHE BOOL "")
set(CURL_DISABLE_SOCKETPAIR ON CACHE BOOL "")
set(CURL_DISABLE_VERBOSE_STRINGS ON CACHE BOOL "")
set(CURL_DISABLE_WEBSOCKETS ON CACHE BOOL "")
set(HTTP_ONLY ON CACHE BOOL "")
set(CURL_ENABLE_SSL OFF CACHE BOOL "")
set(USE_LIBIDN2 OFF CACHE BOOL "")
+1
View File
@@ -2,3 +2,4 @@ unmatchedSuppression
missingIncludeSystem
unusedFunction
useStlAlgorithm
funcArgNamesDifferentUnnamed
+2 -1
View File
@@ -33,7 +33,7 @@ docker compose up
```
#### Optional
* Open ports 18080 (Monero p2p port) and 37889 (P2Pool p2p port) or 37888 (P2Pool-mini p2p port) in your firewall to ensure better connectivity. If you're mining from a computer behind NAT (like a router) you could consider forwarding the ports to your local machine
* Open ports 18080 (Monero p2p port) and 37889/37888/37890 (P2Pool default/mini/nano p2p port) in your firewall to ensure better connectivity. If you're mining from a computer behind NAT (like a router) you could consider forwarding the ports to your local machine
* An XMRig CPU miner is included by default, but you can connect additional miners to this same p2pool node using port 3333 (or alternate if configured) when you set it as "exposed" in the configuration
* Configure your kernel for maximum mining performance: [XMRig RandomX Optimization Guide](https://xmrig.com/docs/miner/randomx-optimization-guide)
* Many optional configurations and customizations are available by running './configure'
@@ -54,4 +54,5 @@ Change to p2pool/docker-compose directory <br />
Stop and remove all containers: ```docker compose down``` <br />
Remove the p2pool data: ```docker volume rm p2pool``` <br />
Remove the p2pool-mini data: ```docker volume rm p2pool-mini``` <br />
Remove the p2pool-nano data: ```docker volume rm p2pool-nano``` <br />
Remove the monero data: ```docker volume rm monero```
+3 -2
View File
@@ -37,7 +37,8 @@ class P2PoolHelpBox(HelpBoxBase):
"P2Pool Sidechain:": [
"Which P2Pool sidechain to mine on",
" use main for faster miners",
" use mini for slower miners",
" use mini for slow miners (>30kH/s)",
" use nano for slower miners (<30kH/s)",
],
"Enable Server Statistics": [
"Provide access to your P2Pool server statictics via a web interface",
@@ -364,7 +365,7 @@ class P2PoolConfigForm(ConfigFormBase):
self.sidechain = self.add(
npyscreen.TitleSelectOne,
name="P2Pool Sidechain:",
values=["main", "mini"],
values=["main", "mini", "nano"],
scroll_exit=True,
max_height=2,
value=[
+7 -3
View File
@@ -7,10 +7,12 @@ networks:
volumes:
p2pool:
{% if sidechain[0] == 0 %}
name: p2pool
{% else %}
{% if sidechain[0] == 1 %}
name: p2pool-mini
{% elif sidechain[0] == 2 %}
name: p2pool-nano
{% else %}
name: p2pool
{% endif %}
{% if configure_monero == True %}
@@ -55,6 +57,8 @@ services:
--loglevel {{ p2pool_log_level | int }}
{% if sidechain[0] == 1 %}
--mini
{% elif sidechain[0] == 2 %}
--nano
{% endif %}
{% if enable_autodiff == False %}
--no-autodiff
+26 -2
View File
@@ -13,6 +13,10 @@
--light-mode Don't allocate RandomX dataset, saves 2GB of RAM
--loglevel Verbosity of the log, integer number between 0 and 6
--data-dir Path to store general p2pool files (log, cache, peer data, etc.), default is current directory
--log-file Path to the log file, default is "p2pool.log" in p2pool's working directory
--no-console-log Disable logging to the console
--no-log-file Disable logging to the file
--disable-log Equivalent to --no-console-log --no-log-file, disables logging entirely and saves ~8 MB of memory
--sidechain-config Name of the p2pool sidechain parameters file (only use it if you run your own sidechain)
--data-api Path to the p2pool JSON data (use it in tandem with an external web-server). Not affected by --data-dir setting!
--local-api Enable /local/ path in api path for Stratum Server and built-in miner statistics
@@ -23,11 +27,12 @@
--out-peers N Maximum number of outgoing connections for p2p server (any value between 10 and 450)
--in-peers N Maximum number of incoming connections for p2p server (any value between 10 and 450)
--start-mining N Start built-in miner using N threads (any value between 1 and 64)
--mini Connect to p2pool-mini sidechain. Note that it will also change default p2p port from 37889 to 37888
--nano Connect to p2pool-nano sidechain. Note that it will also change default p2p port from 37889 to 37890
--mini Connect to p2pool-mini sidechain. Note that it will also change default p2p port from 37889 to 37888. Cannot be used with --nano.
--nano Connect to p2pool-nano sidechain. Note that it will also change default p2p port from 37889 to 37890. Cannot be used with --mini.
--no-autodiff Disable automatic difficulty adjustment for miners connected to stratum (WARNING: incompatible with Nicehash and MRR)
--rpc-login Specify username[:password] required for Monero RPC server
--socks5 Specify IP:port of a SOCKS5 proxy to use for outgoing connections
--socks5-proxy-type The type of SOCKS5 proxy. Can be one of the following values: auto, plain, tor. Default is auto (auto-detect by the port number)
--no-dns Disable DNS queries, use only IP addresses to connect to peers (seed node DNS will be unavailable too)
--p2p-external-port Port number that your router uses for mapping to your local p2p port. Use it if you are behind a NAT and still want to accept incoming connections
--no-upnp Disable UPnP port forwarding
@@ -39,10 +44,13 @@
--tls-cert-key file Load TLS certificate private key from "file" in the PEM format
--rpc-ssl Enable SSL on RPC connections to the Monero node
--rpc-ssl-fingerprint base64-encoded fingerprint of the Monero node's certificate (optional, use it for certificate pinning)
--stratum-proxy-protocol Enable HAProxy PROXY protocol v2 for incoming Stratum connections (use with HAProxy send-proxy-v2)
--p2p-proxy-protocol Enable HAProxy PROXY protocol v2 for incoming P2P connections (use with HAProxy send-proxy-v2)
--no-stratum-http Disable HTTP on Stratum ports
--full-validation Enables full share validation / increases CPU usage
--onion-address Tell other peers to use this .onion address to connect to this node through TOR
--no-clearnet-p2p Forces P2P server to listen on 127.0.0.1 and to not connect to clearnet IPs
--params-file File name to load parameters from. It can't be used together with any other command line parameters
```
### Example command line
@@ -51,6 +59,22 @@
p2pool.exe --host 127.0.0.1 --rpc-port 18081 --zmq-port 18083 --wallet YOUR_WALLET_ADDRESS --stratum 0.0.0.0:3333 --p2p 0.0.0.0:37889
```
### Example command line (params file)
```
p2pool.exe --params-file params.conf
```
params.conf
```
# IP of your node
host = 127.0.0.1
wallet = YOUR_WALLET_ADDRESS
data-api = "/path/to/api/folder" # use quotes if you have spaces in the path
loglevel = 4
mini = 1
```
### Example command line (mining to a subaddress)
```
+45
View File
@@ -0,0 +1,45 @@
## Running P2Pool with I2P
P2Pool has several command-line options that should be used for I2P setup:
- `--socks5 IP:port` to specify your I2P SOCKS proxy address (usually `127.0.0.1:4447` if you are using i2pd or followed the guide below)
- `--socks5-proxy-type i2p` to specify the type of SOCKS5 proxy being used
- `--no-dns` to disable all DNS queries and prevent DNS leaks. P2Pool only ever makes DNS requests to get a list of seed nodes, to resolve your Monero node's domain (if it's not set as an IP address), and to resolve manually added peers
- `--no-upnp` to disable UPnP requests (they are sent to your router, so use this option if you are not on your home network)
- `--i2p-address` your hidden service's `.b32.i2p` address (without port number). This address will be broadcast to other peers when you mine a share in P2Pool. This is to prevent address spamming - you have to mine a real share to be able to broadcast your I2P address.
- **Attention: this also links the I2P address with the Monero wallet you use for mining. Create a new I2P address when mining through I2P, don't use your existing addresses to avoid metadata leaks.**
- `--no-clearnet-p2p` to never connect to clearnet P2Pool nodes.
## Setting up I2P tunnels for P2Pool (i2pd on Linux)
Follow [these instructions](https://docs.i2pd.website/en/latest/user-guide/install/) to install i2pd on your system.
First, ensure the SOCKS proxy tunnel is enabled (as it should be by default). See [here](https://docs.i2pd.website/en/latest/user-guide/configuration/) for more information.
You will need to modify some lines in the `tunnels.conf` file, usually located in `/var/lib/i2pd/tunnels.conf` on Linux.
Add a server tunnel to allow inbound connections from peers:
```ini
[p2pool]
type = server
host = 127.0.0.1
port = 28723
keys = p2pool.dat
```
This will create a hidden service key in `/var/lib/i2pd/p2pool.dat`; you may want to back this up.
Please note that you **must** use the port number shown above in order for other peers to be able to find you.
Restart i2pd:
```bash
sudo systemctl restart i2pd.service
```
Get the hostname of your hidden service:
```bash
curl -s http://127.0.0.1:7070/?page=i2p_tunnels | grep -Eo "[a-zA-Z0-9./?=_%:-]*" | grep "28723"
```
The resulting `.b32.i2p` address should then be used for the `--i2p-address` command-line parameter.
## Command line example
```bash
./p2pool --host MONERO_NODE_IP --wallet YOUR_WALLET --socks5 127.0.0.1:4447 --socks5-proxy-type i2p --no-dns --no-upnp --i2p-address YOUR_I2P_ADDRESS
```
+2 -1
View File
@@ -3,6 +3,7 @@
P2Pool has several command-line options that should be used for TOR setup:
- `--socks5 IP:port` to specify your TOR proxy address (usually `127.0.0.1:9050` if you installed TOR on the same PC)
- `--socks5-proxy-type tor` to specify the type of SOCKS5 proxy being used
- `--no-dns` to disable all DNS queries and prevent DNS leaks. P2Pool only ever makes DNS requests to get a list of seed nodes, to resolve your Monero node's domain (if it's not set as an IP address), and to resolve manually added peers
- `--no-upnp` to disable UPnP requests (they are sent to your router, so use this option if you are not on your home network)
- `--onion-address` your hidden service's address (without port number). This address will be broadcast to other peers when you mine a share in P2Pool. This is to prevent address spamming - you have to mine a real share to be able to broadcast your TOR address.
@@ -27,5 +28,5 @@ P2Pool has several command-line options that should be used for TOR setup:
## Command line example
```
./p2pool --host MONERO_NODE_IP --wallet YOUR_WALLET --socks5 127.0.0.1:9050 --no-dns --no-upnp --onion-address ADDRESS_FROM_HOSTNAME_FILE
./p2pool --host MONERO_NODE_IP --wallet YOUR_WALLET --socks5 127.0.0.1:9050 --socks5-proxy-type tor --no-dns --no-upnp --onion-address ADDRESS_FROM_HOSTNAME_FILE
```
+4 -4
View File
@@ -239,7 +239,6 @@ Wallets with confirmed P2Pool support<br>
<li><a href="https://play.google.com/store/apps/details?id=com.m2049r.xmrwallet" target="_blank">Monerujo v3.0.2 "Fluorine Fermi"</a> and newer
<li><a href="https://play.google.com/store/apps/details?id=com.cakewallet.cake_wallet" target="_blank">Cake Wallet v4.4.5</a> and newer
<li><a href="https://featherwallet.org/" target="_blank">Feather Wallet v2.1.0</a> and newer
<li><a href="https://mymonero.com/" target="_blank">MyMonero</a>
</ul>
It's highly recommended to create a new wallet for mining because wallet addresses are public on p2pool. You can mine to a primary wallet address (the one starting with `4`) for mining. If you want to mine to a subaddress, you will need to provide both the main address (starting with 4) and the subaddress (starting with 8) using "--wallet" and "--subaddress" command line parameters.
</details>
@@ -256,7 +255,7 @@ It's highly recommended to create a new wallet for mining because wallet address
<details><summary>Setup P2Pool node</summary>
<ul>
<li>Download the latest P2Pool <a href="https://github.com/SChernykh/p2pool/releases/latest" target="_blank">release</a>
<li>[Optional] Open port <span>37889</span> (P2Pool port) or <span>37888</span> (P2Pool mini port) in your firewall to ensure better connectivity
<li>[Optional] Open port <span>37889</span> (P2Pool p2p port) in your firewall to ensure better connectivity
<li>Run <span>./p2pool --host 127.0.0.1 --wallet YOUR_WALLET_ADDRESS</span>
<li>It should take no more than 5-10 minutes to synchronize
</ul></details>
@@ -274,6 +273,7 @@ It's highly recommended to create a new wallet for mining because wallet address
<ul>
<li>You can enter your wallet address at <a href="https://p2pool.observer/" target="_blank">P2Pool Observer</a>
<li>P2Pool Observer for P2Pool mini can be found <a href="https://mini.p2pool.observer/" target="_blank">here</a>
<li>P2Pool Observer for P2Pool nano can be found <a href="https://nano.p2pool.observer/" target="_blank">here</a>
<li>You will find your wallet's statistics there only after you've mined at least 1 P2Pool share
</ul>
</details>
@@ -300,7 +300,7 @@ P2Pool is a decentralized community, there is no dedicated support. You can reac
<li><span style="font-size:2rem;color:#e09000;">I have been mining for several hours and still got no rewards?</span>
<ul><li>P2Pool doesn't work exactly like regular pools - there's no "pending balance" here. You need to find a pool share first and then wait for P2Pool to find a Monero block. You'll get a payout to your XMR wallet as soon as a block is found and you have shares in PPLNS window. It can take several days to a week to find a share if your hashrate is low. Type "status" command in P2Pool console or visit <a href="https://p2pool.observer/" target="_blank">P2Pool observer</a> to check your progress.</ul><br>
<li><span style="font-size:2rem;color:#e09000;">I am mining but I can't find any shares</span>
<ul><li>First check for any warnings and errors in P2Pool console and logs. If everything works fine, you can check the <a href="https://p2pool.observer/calculate-share-time" target="_blank">average share time calculator</a> to get an idea how often you should find a share with your hashrate. If this time is more than 1 day, it's recommended to switch to P2Pool mini by adding <span style="color:#808080;">--mini</span> to P2Pool command line.</ul><br>
<ul><li>First check for any warnings and errors in P2Pool console and logs. If everything works fine, you can check the <a href="https://p2pool.observer/calculate-share-time" target="_blank">average share time calculator</a> to get an idea how often you should find a share with your hashrate. If this time is more than 1 day, it's recommended to switch to either P2Pool mini or nano by adding <span style="color:#808080;">--mini</span> or <span style="color:#808080;">--nano</span> to P2Pool command line.</ul><br>
<li><span style="font-size:2rem;color:#e09000;">I get an error "monerod RPC ... is incompatible, update to RPC >= v3.8"</span>
<ul><li>Use monerod v0.18.0.0 or newer</ul><br>
<li><span style="font-size:2rem;color:#e09000;">I get warnings "peer ... is ahead on mainchain (height ..., your height ...). Is your monerod stuck or lagging?"</span>
@@ -314,4 +314,4 @@ Donate to support the project:<br><span style="font-size:0.9rem;color:#b0b0b0;">
&nbsp;
</div>
</body>
</html>
</html>
+4 -4
View File
@@ -239,7 +239,6 @@ Wallets with confirmed P2Pool support<br>
<li><a href="https://play.google.com/store/apps/details?id=com.m2049r.xmrwallet" target="_blank">Monerujo v3.0.2 "Fluorine Fermi"</a> and newer
<li><a href="https://play.google.com/store/apps/details?id=com.cakewallet.cake_wallet" target="_blank">Cake Wallet v4.4.5</a> and newer
<li><a href="https://featherwallet.org/" target="_blank">Feather Wallet v2.1.0</a> and newer
<li><a href="https://mymonero.com/" target="_blank">MyMonero</a>
</ul>
It's highly recommended to create a new wallet for mining because wallet addresses are public on p2pool. You can mine to a primary wallet address (the one starting with `4`) for mining. If you want to mine to a subaddress, you will need to provide both the main address (starting with 4) and the subaddress (starting with 8) using "--wallet" and "--subaddress" command line parameters.
</details>
@@ -256,7 +255,7 @@ It's highly recommended to create a new wallet for mining because wallet address
<details><summary>Setup P2Pool node</summary>
<ul>
<li>Download the latest P2Pool <a href="https://github.com/SChernykh/p2pool/releases/latest" target="_blank">release</a>
<li>[Optional] Open port <span>37889</span> (P2Pool port) or <span>37888</span> (P2Pool mini port) in your firewall to ensure better connectivity
<li>[Optional] Open port <span>37888</span> (P2Pool mini p2p port) in your firewall to ensure better connectivity
<li>Run <span>./p2pool --host 127.0.0.1 --wallet YOUR_WALLET_ADDRESS --mini</span>
<li>It should take no more than 5-10 minutes to synchronize
</ul></details>
@@ -274,6 +273,7 @@ It's highly recommended to create a new wallet for mining because wallet address
<ul>
<li>You can enter your wallet address at <a href="https://p2pool.observer/" target="_blank">P2Pool Observer</a>
<li>P2Pool Observer for P2Pool mini can be found <a href="https://mini.p2pool.observer/" target="_blank">here</a>
<li>P2Pool Observer for P2Pool nano can be found <a href="https://nano.p2pool.observer/" target="_blank">here</a>
<li>You will find your wallet's statistics there only after you've mined at least 1 P2Pool share
</ul>
</details>
@@ -300,7 +300,7 @@ P2Pool is a decentralized community, there is no dedicated support. You can reac
<li><span style="font-size:2rem;color:#e09000;">I have been mining for several hours and still got no rewards?</span>
<ul><li>P2Pool doesn't work exactly like regular pools - there's no "pending balance" here. You need to find a pool share first and then wait for P2Pool to find a Monero block. You'll get a payout to your XMR wallet as soon as a block is found and you have shares in PPLNS window. It can take several days to a week to find a share if your hashrate is low. Type "status" command in P2Pool console or visit <a href="https://mini.p2pool.observer/" target="_blank">P2Pool observer</a> to check your progress.</ul><br>
<li><span style="font-size:2rem;color:#e09000;">I am mining but I can't find any shares</span>
<ul><li>First check for any warnings and errors in P2Pool console and logs. If everything works fine, you can check the <a href="https://p2pool.observer/calculate-share-time" target="_blank">average share time calculator</a> to get an idea how often you should find a share with your hashrate. If this time is more than 1 day, it's recommended to switch to P2Pool mini by adding <span style="color:#808080;">--mini</span> to P2Pool command line.</ul><br>
<ul><li>First check for any warnings and errors in P2Pool console and logs. If everything works fine, you can check the <a href="https://p2pool.observer/calculate-share-time" target="_blank">average share time calculator</a> to get an idea how often you should find a share with your hashrate. If this time is more than 1 day, it's recommended to switch to P2Pool mini or nano by adding <span style="color:#808080;">--mini</span> or <span style="color:#808080;">--nano</span> to P2Pool command line.</ul><br>
<li><span style="font-size:2rem;color:#e09000;">I get an error "monerod RPC ... is incompatible, update to RPC >= v3.8"</span>
<ul><li>Use monerod v0.18.0.0 or newer</ul><br>
<li><span style="font-size:2rem;color:#e09000;">I get warnings "peer ... is ahead on mainchain (height ..., your height ...). Is your monerod stuck or lagging?"</span>
@@ -314,4 +314,4 @@ Donate to support the project:<br><span style="font-size:0.9rem;color:#b0b0b0;">
&nbsp;
</div>
</body>
</html>
</html>
+3 -3
View File
@@ -242,7 +242,6 @@ Wallets with confirmed P2Pool support<br>
<li><a href="https://play.google.com/store/apps/details?id=com.m2049r.xmrwallet" target="_blank">Monerujo v3.0.2 "Fluorine Fermi"</a> and newer
<li><a href="https://play.google.com/store/apps/details?id=com.cakewallet.cake_wallet" target="_blank">Cake Wallet v4.4.5</a> and newer
<li><a href="https://featherwallet.org/" target="_blank">Feather Wallet v2.1.0</a> and newer
<li><a href="https://mymonero.com/" target="_blank">MyMonero</a>
</ul>
It's highly recommended to create a new wallet for mining because wallet addresses are public on p2pool. You can mine to a primary wallet address (the one starting with `4`) for mining. If you want to mine to a subaddress, you will need to provide both the main address (starting with 4) and the subaddress (starting with 8) using "--wallet" and "--subaddress" command line parameters.
</details>
@@ -259,7 +258,7 @@ It's highly recommended to create a new wallet for mining because wallet address
<details><summary>Setup P2Pool node</summary>
<ul>
<li>Download the latest P2Pool <a href="https://github.com/SChernykh/p2pool/releases/latest" target="_blank">release</a>
<li>[Optional] Open port <span>37889</span> (P2Pool port) or <span>37890</span> (P2Pool nano port) in your firewall to ensure better connectivity
<li>[Optional] Open port <span>37890</span> (P2Pool nano p2p port) in your firewall to ensure better connectivity
<li>Run <span>./p2pool --host 127.0.0.1 --wallet YOUR_WALLET_ADDRESS --nano</span>
<li>It should take no more than 5-10 minutes to synchronize
</ul></details>
@@ -276,6 +275,7 @@ It's highly recommended to create a new wallet for mining because wallet address
<details><summary>Checking your progress</summary>
<ul>
<li>You can enter your wallet address at <a href="https://p2pool.observer/" target="_blank">P2Pool Observer</a>
<li>P2Pool Observer for P2Pool mini can be found <a href="https://mini.p2pool.observer/" target="_blank">here</a>
<li>P2Pool Observer for P2Pool nano can be found <a href="https://nano.p2pool.observer/" target="_blank">here</a>
<li>You will find your wallet's statistics there only after you've mined at least 1 P2Pool share
</ul>
@@ -317,4 +317,4 @@ Donate to support the project:<br><span style="font-size:0.9rem;color:#b0b0b0;">
&nbsp;
</div>
</body>
</html>
</html>
+14 -16
View File
@@ -1,5 +1,5 @@
diff --git a/crypto/rand/windows.cc b/crypto/rand/windows.cc
index 59df467e7..aa5ac076c 100644
index ebd0d4afd..65e877f0e 100644
--- a/crypto/rand/windows.cc
+++ b/crypto/rand/windows.cc
@@ -24,6 +24,7 @@
@@ -8,12 +8,12 @@ index 59df467e7..aa5ac076c 100644
#include <windows.h>
+#include <wincrypt.h>
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
@@ -57,16 +58,40 @@ void CRYPTO_sysrand(uint8_t *out, size_t requested) {
using namespace bssl;
@@ -59,16 +60,39 @@ void bssl::CRYPTO_sysrand(uint8_t *out, size_t requested) {
// See: https://learn.microsoft.com/en-us/windows/win32/seccng/processprng
typedef BOOL (WINAPI *ProcessPrngFunction)(PBYTE pbData, SIZE_T cbData);
static ProcessPrngFunction g_processprng_fn = NULL;
typedef BOOL(WINAPI *ProcessPrngFunction)(PBYTE pbData, SIZE_T cbData);
static ProcessPrngFunction g_processprng_fn = nullptr;
+static HCRYPTPROV g_hCryptProv = 0;
+
+static BOOL WINAPI wrapper_CryptGenRandom(PBYTE pbData, SIZE_T cbData)
@@ -21,21 +21,19 @@ index 59df467e7..aa5ac076c 100644
+ return CryptGenRandom(g_hCryptProv, cbData, pbData);
+}
static void init_processprng(void) {
static void init_processprng() {
HMODULE hmod = LoadLibraryW(L"bcryptprimitives");
- if (hmod == NULL) {
- if (hmod == nullptr) {
- abort();
- }
- g_processprng_fn = (ProcessPrngFunction)GetProcAddress(hmod, "ProcessPrng");
- if (g_processprng_fn == NULL) {
- abort();
+
+ if (hmod) {
+ g_processprng_fn = (ProcessPrngFunction)GetProcAddress(hmod, "ProcessPrng");
+ if (g_processprng_fn) {
+ return;
+ }
+ }
}
- g_processprng_fn = (ProcessPrngFunction)GetProcAddress(hmod, "ProcessPrng");
- if (g_processprng_fn == nullptr) {
- abort();
+
+ if (CryptAcquireContext(&g_hCryptProv, NULL, NULL, PROV_RSA_FULL, 0)) {
+ g_processprng_fn = &wrapper_CryptGenRandom;
@@ -51,9 +49,9 @@ index 59df467e7..aa5ac076c 100644
+ else {
+ err = GetLastError();
+ }
+ }
+ }
+
+ abort();
}
void CRYPTO_init_sysrand(void) {
void bssl::CRYPTO_init_sysrand() {
+1 -1
View File
@@ -16,7 +16,7 @@ do
gcc/build.sh $1 $i
done
for i in 17 21;
for i in 17 22;
do
clang/build.sh $1 $i
done
-2
View File
@@ -1,6 +1,4 @@
#!/bin/sh
set -e
cd /p2pool
mkdir build && cd build
-2
View File
@@ -1,6 +1,4 @@
#!/bin/sh
set -e
cd /p2pool
mkdir build && cd build
@@ -127,7 +127,7 @@ cd /root
curl -L -O https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
for i in 17 18 19 20 21;
for i in 17 18 19 20 21 22;
do
./llvm.sh $i
done
@@ -20,7 +20,7 @@ flags_libs="--target=aarch64-unknown-freebsd12.0 --sysroot=/usr/local/cross-free
flags_p2pool="--target=aarch64-unknown-freebsd12.0 --sysroot=/usr/local/cross-freebsd-aarch64 -fuse-ld=lld -Wno-unused-command-line-argument $flags_size $flags_datetime"
cd /p2pool/external/src/curl
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/freebsd_aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/freebsd_aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j$(nproc)
cd /p2pool/external/src/libuv
@@ -20,7 +20,7 @@ flags_libs="--target=x86_64-unknown-freebsd12.0 --sysroot=/usr/local/cross-freeb
flags_p2pool="--target=x86_64-unknown-freebsd12.0 --sysroot=/usr/local/cross-freebsd-x86_64 -fuse-ld=lld -Wno-unused-command-line-argument $flags_size $flags_datetime"
cd /p2pool/external/src/curl
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/freebsd_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/freebsd_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j$(nproc)
cd /p2pool/external/src/libuv
+17 -17
View File
@@ -3,28 +3,28 @@ set -e
# Software versions to install
_7ZIP_VERSION=2501
BINUTILS_VERSION=2_45
CLANG_VERSION=21.1.5
CMAKE_VERSION=4.1.2
_7ZIP_VERSION=2601
BINUTILS_VERSION=2_46
CLANG_VERSION=21.1.8
CMAKE_VERSION=4.3.2
FREEBSD_VERSION=12.4
GCC_VERSION=15.2.0
GLIBC_VERSION=2.42
LINUX_HEADERS_VERSION=6.17.7
MACOSX_SDK_VERSION=26.0
OSXCROSS_VERSION=7e8a4d170cc6bda1f0a32f5dc5f6ace4676baf98
GLIBC_VERSION=2.43
LINUX_HEADERS_VERSION=6.19.14
MACOSX_SDK_VERSION=26.1
OSXCROSS_VERSION=2bc739ebe45db5d72e176d2a4e1c7dd95464e8e2
MAKE_VERSION=4.4.1
MINGW_VERSION=13.0.0
XZ_VERSION=5.8.1
MINGW_VERSION=14.0.0
XZ_VERSION=5.8.3
TAR_VERSION=1.35
_7ZIP_SHA256="4ca3b7c6f2f67866b92622818b58233dc70367be2f36b498eb0bdeaaa44b53f4"
CMAKE_SHA256="773cc679c3a7395413bd096523f8e5d6c39f8718af4e12eb4e4195f72f35e4ab"
_7ZIP_SHA256="8ea0fc8a135e7b848e80a4116fe22dff56c8c4518dde1f43cce67f4e340b437a"
CMAKE_SHA256="791ae3604841ca03cb3889a3ad89165346e4b180ae3448efd4b0caa9ef46d245"
FREEBSD_AARCH64_SHA256="6c401819bfb93e810c9f9aa670a1e4685f924df5e7e0c9c6397dd6c16c954fa2"
FREEBSD_X86_64_SHA256="581c7edacfd2fca2bdf5791f667402d22fccd8a5e184635e0cac075564d57aa8"
GLIBC_SHA256="d1775e32e4628e64ef930f435b67bb63af7599acb6be2b335b9f19f16509f17f"
HEADERS_SHA256="ddf2ea0d4439e1d57136be3623102af9458f601f5b1cb77e83246e88aea09d0e"
MACOSX_SDK_SHA256="07ccaa2891454713c3a230dd87283f76124193309d9a7617ebee45354c9302d2"
GLIBC_SHA256="d9c86c6b5dbddb43a3e08270c5844fc5177d19442cf5b8df4be7c07cd5fa3831"
HEADERS_SHA256="cde8bf6739be4a0777fedbbba5330b8188c55680c45a922a4dfa289cbec6f185"
MACOSX_SDK_SHA256="beee7212d265a6d2867d0236cc069314b38d5fb3486a6515734e76fa210c784c"
MAKE_SHA256="dd16fb1d67bfab79a72f5e8390735c49e3e8e70b4945a15ab1f81ddb78658fb3"
TAR_SHA256="4d62ff37342ec7aed748535323930c7cf94acf71c3591882b26a7ea50f3edc16"
@@ -33,7 +33,7 @@ echo "Install prerequisites"
export DEBIAN_FRONTEND=noninteractive
apt-get update && apt-get upgrade -yq --no-install-recommends
apt-get install -yq --no-install-recommends ca-certificates curl bzip2 flex texinfo bison ninja-build python3 file rsync xz-utils gawk gettext patch git gcc g++
apt-get install -yq --no-install-recommends ca-certificates curl bzip2 flex texinfo bison ninja-build python3 python3-yaml file rsync xz-utils gawk gettext patch git gcc g++
echo "Cloning the P2Pool repository in background"
@@ -227,7 +227,7 @@ cd /root
tar xvf $CMAKE_FILE
cp $CMAKE_NAME/bin/* /usr/local/bin
cp -r $CMAKE_NAME/share/cmake-4.1 /usr/local/share
cp -r $CMAKE_NAME/share/cmake-4.3 /usr/local/share
echo "Install clang"
@@ -20,7 +20,7 @@ flags_libs="--target=aarch64-linux-gnu -Os -flto -fuse-ld=lld -w $flags_size $fl
flags_p2pool="--target=aarch64-linux-gnu -fuse-ld=lld -Wno-unused-command-line-argument $flags_size $flags_datetime"
cd /p2pool/external/src/curl
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j$(nproc)
cd /p2pool/external/src/libuv
@@ -20,7 +20,7 @@ flags_libs="--target=riscv64-linux-gnu -Os -flto -fuse-ld=lld -w $flags_size $fl
flags_p2pool="--target=riscv64-linux-gnu -fuse-ld=lld -Wno-unused-command-line-argument $flags_size $flags_datetime"
cd /p2pool/external/src/curl
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/riscv64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/riscv64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j$(nproc)
cd /p2pool/external/src/libuv
@@ -20,7 +20,7 @@ flags_libs="-Os -flto -fuse-ld=lld -w $flags_size $flags_datetime"
flags_p2pool="-fuse-ld=lld -Wno-unused-command-line-argument $flags_size $flags_datetime"
cd /p2pool/external/src/curl
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_C_COMPILER=clang -DCMAKE_C_FLAGS="$flags_libs" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_C_COMPILER=clang -DCMAKE_C_FLAGS="$flags_libs" -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j$(nproc)
cd /p2pool/external/src/libuv
@@ -20,7 +20,7 @@ flags_libs="-Os -flto -w $flags_size $flags_datetime"
flags_p2pool="$flags_size $flags_datetime"
cd /p2pool/external/src/curl
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/macos_aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/macos_aarch64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j$(nproc)
cd /p2pool/external/src/libuv
@@ -20,7 +20,7 @@ flags_libs="-Os -flto -w $flags_size $flags_datetime"
flags_p2pool="$flags_size $flags_datetime"
cd /p2pool/external/src/curl
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/macos_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/macos_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j$(nproc)
cd /p2pool/external/src/libuv
@@ -25,7 +25,7 @@ cd /p2pool
git apply --verbose --ignore-whitespace --directory=external/src/grpc/third_party/boringssl-with-bazel patches/boringssl/win7.patch
cd /p2pool/external/src/curl
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/windows_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DCURL_DISABLE_WEBSOCKETS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
cmake . -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE=../../../cmake/windows_x86_64_toolchain_clang.cmake -DCMAKE_C_FLAGS="$flags_libs" -DCURL_DROP_UNUSED=ON -DCURL_DISABLE_TYPECHECK=ON -DCURL_DISABLE_OPENSSL_AUTO_LOAD_CONFIG=ON -DCURL_DISABLE_SHA512_256=ON -DPICKY_COMPILER=OFF -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_DISABLE_INSTALL=ON -DCURL_ENABLE_EXPORT_TARGET=OFF -DCURL_DISABLE_HEADERS_API=ON -DCURL_DISABLE_BINDLOCAL=ON -DBUILD_LIBCURL_DOCS=OFF -DBUILD_MISC_DOCS=OFF -DENABLE_CURL_MANUAL=OFF -DCURL_ZLIB=OFF -DCURL_BROTLI=OFF -DCURL_ZSTD=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF -DBUILD_TESTING=OFF -DUSE_NGHTTP2=OFF -DBUILD_EXAMPLES=OFF -DP2POOL_BORINGSSL=ON -DCURL_DISABLE_SRP=ON -DCURL_DISABLE_AWS=ON -DCURL_DISABLE_BASIC_AUTH=ON -DCURL_DISABLE_BEARER_AUTH=ON -DCURL_DISABLE_KERBEROS_AUTH=ON -DCURL_DISABLE_NEGOTIATE_AUTH=ON -DOPENSSL_INCLUDE_DIR=../grpc/third_party/boringssl-with-bazel/include
make -j$(nproc)
cd /p2pool/external/src/libuv
+1 -1
View File
@@ -1,5 +1,5 @@
#!/bin/bash
grep 'ERROR ' p2pool.log | grep -E -v 'submit_block|failed to bind|ZMQ is not running|block header for seed' > errors.log
grep 'ERROR ' p2pool.log | grep -E -v 'submit_block|failed to bind|ZMQ is not running|block header for seed|ZMQReader|ZMQ reader|uv_poll_start returned error EBADF' > errors.log
if [ -s errors.log ]; then
cat errors.log
+3
View File
@@ -4,6 +4,9 @@
//
// Fixed difficulty for miners that connect to your node must be set in their config.json
//
// Note: nano sidechain uses
// "block_time": 30
// "uncle_penalty": 10
{
"name": "default",
"password": "",
+8 -7
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@
#include "pool_block.h"
#include "p2p_server.h"
#include "side_chain.h"
#include "params.h"
LOG_CATEGORY(BlockCache)
@@ -34,9 +35,9 @@ struct BlockCache::Impl : public nocopy_nomove
{
#if defined(__linux__) || defined(__unix__) || defined(_POSIX_VERSION) || defined(__MACH__)
Impl()
explicit Impl(const Params& params)
{
const std::string cache_path = DATA_DIR + cache_name;
const std::string cache_path = params.m_dataDir + cache_name;
m_fd = open(cache_path.c_str(), O_RDWR | O_CREAT, static_cast<mode_t>(0600));
if (m_fd == -1) {
@@ -88,8 +89,8 @@ struct BlockCache::Impl : public nocopy_nomove
#elif defined(_WIN32)
Impl()
: m_cachePath(DATA_DIR + cache_name)
explicit Impl(const Params& params)
: m_cachePath(params.m_dataDir + cache_name)
, m_file(CreateFile(m_cachePath.c_str(), GENERIC_ALL, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_HIDDEN, NULL))
, m_map(0)
{
@@ -157,8 +158,8 @@ struct BlockCache::Impl : public nocopy_nomove
uint8_t* m_data = nullptr;
};
BlockCache::BlockCache()
: m_impl(new Impl())
BlockCache::BlockCache(const Params& params)
: m_impl(new Impl(params))
, m_flushRunning(0)
, m_storeIndex(0)
, m_loadingStarted(0)
+3 -2
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,11 +22,12 @@ namespace p2pool {
struct PoolBlock;
class SideChain;
class P2PServer;
struct Params;
class BlockCache : public nocopy_nomove
{
public:
BlockCache();
explicit BlockCache(const Params& params);
~BlockCache();
void store(const PoolBlock& block);
+26 -17
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
* Portions Copyright (c) 2012-2013 The Cryptonote developers
* Portions Copyright (c) 2014-2021 The Monero Project
* Portions Copyright (c) 2021 XMRig <https://github.com/xmrig>
@@ -149,6 +149,7 @@ BlockTemplate& BlockTemplate::operator=(const BlockTemplate& b)
m_blockHeader.clear();
m_minerTxExtra.clear();
m_transactionHashes.clear();
m_transactionHashesSet.clear();
m_rewards.clear();
m_mempoolTxs.clear();
m_mempoolTxsOrder.clear();
@@ -204,7 +205,7 @@ void BlockTemplate::shuffle_tx_order()
}
}
void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const Params* params)
void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const Params& params)
{
if (data.major_version > HARDFORK_SUPPORTED_VERSION) {
LOGERR(1, "got hardfork version " << data.major_version << ", expected <= " << HARDFORK_SUPPORTED_VERSION);
@@ -213,7 +214,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
// Block template construction is relatively slow, but it's better to keep the lock the whole time
// instead of using temporary variables and making a quick swap in the end
//
//
// All readers will line up for the new template instead of using the outdated template
WriteLock lock(m_lock);
@@ -269,7 +270,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
m_blockHeaderSize = m_blockHeader.size();
m_poolBlockTemplate->m_minerWallet = params->m_miningWallet;
m_poolBlockTemplate->m_minerWallet = params.m_miningWallet;
if (!m_sidechain->fill_sidechain_data(*m_poolBlockTemplate, m_shares)) {
use_old_template();
@@ -521,8 +522,6 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
return;
}
m_finalReward = final_reward;
const int create_miner_tx_result = create_miner_tx(data, m_shares, max_reward_amounts_weight, false);
if (create_miner_tx_result < 0) {
if (create_miner_tx_result == -3) {
@@ -578,6 +577,8 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
return;
}
m_finalReward = final_reward;
m_blockTemplateBlob = m_blockHeader;
m_extraNonceOffsetInTemplate += m_blockHeader.size();
m_minerTxOffsetInTemplate = m_blockHeader.size();
@@ -595,7 +596,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
m_poolBlockTemplate->m_transactions.push_back(m_mempoolTxs[m_mempoolTxsOrder[i]].id);
}
m_poolBlockTemplate->m_minerWallet = params->m_miningWallet;
m_poolBlockTemplate->m_minerWallet = params.m_miningWallet;
// Layout: [software id, version, random number, sidechain extra_nonce]
uint32_t* sidechain_extra = m_poolBlockTemplate->m_sidechainExtraBuf;
@@ -617,7 +618,7 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
m_poolBlockTemplate->m_auxNonce = data.aux_nonce;
m_poolBlockTemplate->m_mergeMiningExtra.clear();
for (const AuxChainData& c : data.aux_chains) {
std::vector<uint8_t> v;
v.reserve(HASH_SIZE + 16);
@@ -630,20 +631,27 @@ void BlockTemplate::update(const MinerData& data, const Mempool& mempool, const
m_poolBlockTemplate->m_mergeMiningExtra.emplace(c.unique_id, std::move(v));
}
if (params->m_subaddress.valid()) {
if (params.m_subaddress.valid()) {
uint8_t buf[HASH_SIZE + 2] = {};
memcpy(buf, params->m_subaddress.view_public_key().h, HASH_SIZE);
memcpy(buf, params.m_subaddress.view_public_key().h, HASH_SIZE);
m_poolBlockTemplate->m_mergeMiningExtra.emplace(keccak_subaddress_viewpub, std::vector(buf, buf + sizeof(buf)));
}
if (!params->m_onionPubkey.empty()) {
if (!params.m_onionPubkey.empty()) {
uint8_t buf[HASH_SIZE + 2] = {};
memcpy(buf, params->m_onionPubkey.h, HASH_SIZE);
memcpy(buf, params.m_onionPubkey.h, HASH_SIZE);
m_poolBlockTemplate->m_mergeMiningExtra.emplace(keccak_onion_address_v3, std::vector(buf, buf + sizeof(buf)));
}
if (!params.m_i2pDestinationHash.empty()) {
uint8_t buf[HASH_SIZE + 2] = {};
memcpy(buf, params.m_i2pDestinationHash.h, HASH_SIZE);
m_poolBlockTemplate->m_mergeMiningExtra.emplace(keccak_i2p_b32_address, std::vector(buf, buf + sizeof(buf)));
}
init_merge_mining_merkle_proof();
const std::vector<uint8_t> sidechain_data = m_poolBlockTemplate->serialize_sidechain_data();
@@ -752,7 +760,7 @@ void BlockTemplate::fill_optimal_knapsack(const MinerData& data, uint64_t base_r
{
// Find the maximum possible fee for every weight value and remember which tx leads to this fee/weight
// Run time is O(N*W) where N is the number of transactions and W is the maximum block weight
//
//
// Actual run time is 0.02-0.05 seconds on real full blocks
// It's too slow and uses too much memory to be practical
@@ -975,7 +983,7 @@ int BlockTemplate::create_miner_tx(const MinerData& data, const std::vector<Mine
LOGINFO(4, "increased EXTRA_NONCE from " << EXTRA_NONCE_SIZE << " to " << corrected_extra_nonce_size << " bytes to maintain miner tx weight");
}
writeVarint(corrected_extra_nonce_size, m_minerTxExtra);
uint64_t extraNonceOffsetInMinerTx = m_minerTxExtra.size();
m_minerTxExtra.insert(m_minerTxExtra.end(), corrected_extra_nonce_size, 0);
@@ -1406,7 +1414,7 @@ bool BlockTemplate::get_aux_proof(const uint32_t template_id, uint32_t extra_non
uint32_t path2 = 0;
const bool result2 = get_merkle_proof(tree, h, proof2, path2);
if ((result2 != result) || (proof2 != proof) || (path2 != path)) {
LOGERR(1, "get_aux_proof: merkle_hash_with_proof and get_merkle_proof returned different results. Fix the code!");
}
@@ -1553,7 +1561,8 @@ void BlockTemplate::init_merge_mining_merkle_proof()
}
root_hash root;
if (!merkle_hash_with_proof(hashes, aux_slot, m_poolBlockTemplate->m_merkleProof, m_poolBlockTemplate->m_merkleProofPath, root)) {
uint32_t merkle_proof_path;
if (!merkle_hash_with_proof(hashes, aux_slot, m_poolBlockTemplate->m_merkleProof, merkle_proof_path, root)) {
LOGERR(1, "init_merge_mining_merkle_proof: merkle_hash_with_proof failed. Fix the code!");
return;
}
@@ -1570,7 +1579,7 @@ void BlockTemplate::init_merge_mining_merkle_proof()
return;
}
if ((proof != m_poolBlockTemplate->m_merkleProof) || (path != m_poolBlockTemplate->m_merkleProofPath)) {
if ((proof != m_poolBlockTemplate->m_merkleProof) || (path != merkle_proof_path)) {
LOGERR(1, "init_merge_mining_merkle_proof: merkle_hash_with_proof and get_merkle_proof returned different results. Fix the code!");
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@ public:
BlockTemplate(const BlockTemplate& b);
BlockTemplate& operator=(const BlockTemplate& b);
void update(const MinerData& data, const Mempool& mempool, const Params* params);
void update(const MinerData& data, const Mempool& mempool, const Params& params);
uint64_t last_updated() const { return m_lastUpdated.load(); }
bool get_difficulties(const uint32_t template_id, uint64_t& height, uint64_t& sidechain_height, difficulty_type& mainchain_difficulty, difficulty_type& aux_diff, difficulty_type& sidechain_difficulty) const;
+25 -9
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -162,9 +162,9 @@ struct alignas(uint64_t) hash
{
uint8_t h[HASH_SIZE];
FORCEINLINE constexpr hash() : h{} {}
FORCEINLINE constexpr hash() noexcept : h{} {}
constexpr hash(std::initializer_list<uint8_t> l) : h{} {
constexpr hash(std::initializer_list<uint8_t> l) noexcept : h{} {
auto it = l.begin();
for (size_t i = 0; (i < HASH_SIZE) && (it != l.end()); ++i, ++it) {
@@ -172,6 +172,22 @@ struct alignas(uint64_t) hash
}
}
explicit constexpr hash(const char (&s)[HASH_SIZE * 2 + 1]) noexcept : h{} {
for (size_t i = 0; i < HASH_SIZE * 2; ++i) {
char c = s[i];
if ('0' <= c && c <= '9') {
c -= '0';
} else if ('a' <= c && c <= 'f') {
c = (c - 'a') + 10;
} else if ('A' <= c && c <= 'F') {
c = (c - 'A') + 10;
}
h[i / 2] = (h[i / 2] << 4) | static_cast<uint8_t>(c);
}
}
FORCEINLINE bool operator<(const hash& other) const
{
const uint64_t* a = u64();
@@ -401,18 +417,18 @@ struct indexed_hash
BUCKET_SHIFT = 32 - BUCKET_BITS,
};
static_assert((BUCKET_BITS > 0) && (BUCKET_BITS < 32), "Invalid bucket bit size");
static_assert((BUCKET_BITS > 0) && (BUCKET_BITS < 32) && (BUCKET_BITS + BUCKET_SHIFT == 32), "Invalid bucket bit size");
FORCEINLINE indexed_hash() : m_index(std::numeric_limits<uint32_t>::max()) {}
FORCEINLINE indexed_hash() noexcept : m_index(std::numeric_limits<uint32_t>::max()) {}
explicit indexed_hash(const hash& h);
~indexed_hash();
indexed_hash(const indexed_hash& h);
FORCEINLINE indexed_hash(indexed_hash&& h) : m_index(h.m_index) { h.m_index = std::numeric_limits<uint32_t>::max(); }
indexed_hash(const indexed_hash& h) noexcept;
FORCEINLINE indexed_hash(indexed_hash&& h) noexcept : m_index(h.m_index) { h.m_index = std::numeric_limits<uint32_t>::max(); }
indexed_hash& operator=(const indexed_hash& h);
indexed_hash& operator=(indexed_hash&& h);
indexed_hash& operator=(const indexed_hash& h) noexcept;
indexed_hash& operator=(indexed_hash&& h) noexcept;
FORCEINLINE indexed_hash& operator=(const hash& h)
{
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021 hyc <https://github.com/hyc>
*
* This program is free software: you can redistribute it and/or modify
@@ -35,7 +35,7 @@ static constexpr int DEFAULT_BACKLOG = 1;
namespace p2pool {
ConsoleCommands::ConsoleCommands(p2pool* pool)
: TCPServer(DEFAULT_BACKLOG, ConsoleClient::allocate, std::string())
: TCPServer(DEFAULT_BACKLOG, ConsoleClient::allocate, std::string(), Params::ProxyType::INVALID)
, m_pool(pool)
, m_tty{}
, m_stdin_pipe{}
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+4 -4
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -358,7 +358,7 @@ private:
uint32_t m_viewTags1[2] = { 0xFFFFFFFFUL, 0xFFFFFFFFUL };
std::vector<uint32_t> m_viewTags2;
// cppcheck-suppress unusedStructMember
uint32_t m_timestamp;
uint32_t m_timestamp = 0;
FORCEINLINE bool find_view_tag(size_t output_index, uint8_t& view_tag) const
{
@@ -410,7 +410,7 @@ private:
{
indexed_hash m_key;
// cppcheck-suppress unusedStructMember
uint32_t m_timestamp;
uint32_t m_timestamp = 0;
};
struct TxKeyEntry
@@ -418,7 +418,7 @@ private:
hash m_pub;
hash m_sec;
// cppcheck-suppress unusedStructMember
uint32_t m_timestamp;
uint32_t m_timestamp = 0;
};
typedef unordered_map<std::array<uint8_t, HASH_SIZE * 2>, DerivationEntry> DerivationsMap;
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+76
View File
@@ -0,0 +1,76 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2026 jpk68
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common.h"
#include "util.h"
#include "i2p.h"
LOG_CATEGORY(I2P)
namespace p2pool {
hash from_i2p_b32(const std::string& address)
{
if ((address.length() < 8) || (address.find(".b32.i2p") != address.length() - 8)) {
LOGWARN(3, "Invalid I2P address \"" << address << "\": doesn't end with \".b32.i2p\"");
return {};
}
if (address.length() != 60) {
LOGWARN(3, "Invalid I2P address \"" << address << "\": expected length 60, got " << address.length());
return {};
}
const hash result = from_i2p_b32_const(address.c_str());
if (result.empty()) {
LOGWARN(3, "Invalid I2P address \"" << address << "\": has invalid character(s)");
return {};
}
return result;
}
std::string to_i2p_b32(const hash& dest_hash)
{
uint8_t buf[HASH_SIZE + 1];
memcpy(buf, dest_hash.h, HASH_SIZE);
buf[HASH_SIZE] = 0;
std::string result;
result.reserve(60);
uint64_t data = 0;
uint64_t bit_size = 0;
for (size_t i = 0; i < HASH_SIZE + 1; ++i) {
data = (data << 8) | buf[i];
bit_size += 8;
while (bit_size >= 5) {
bit_size -= 5;
result += base32_alphabet[(data >> bit_size) & 31];
}
}
result.append(".b32.i2p");
return result;
}
} // namespace p2pool
+73
View File
@@ -0,0 +1,73 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2026 jpk68
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "common.h"
#include <string>
#include <uv.h>
namespace p2pool {
static FORCEINLINE constexpr hash from_i2p_b32_const(const char* dest_hash)
{
uint8_t buf[HASH_SIZE + 4] = {};
uint8_t* p = buf;
uint64_t data = 0;
uint64_t bit_size = 0;
for (size_t i = 0; i < 52; ++i) {
const char c = dest_hash[i];
uint64_t digit = 0;
if ('a' <= c && c <= 'z') {
digit = static_cast<uint64_t>(c - 'a');
}
else if ('A' <= c && c <= 'Z') {
digit = static_cast<uint64_t>(c - 'A');
}
else if ('2' <= c && c <= '7') {
digit = static_cast<uint64_t>(c - '2') + 26;
}
else {
return {};
}
data = (data << 5) | digit;
bit_size += 5;
while (bit_size >= 8) {
bit_size -= 8;
*(p++) = static_cast<uint8_t>(data >> bit_size);
}
}
hash result;
for (size_t i = 0; i < HASH_SIZE; ++i) {
result.h[i] = buf[i];
}
return result;
}
hash from_i2p_b32(const std::string& address);
std::string to_i2p_b32(const hash& dest_hash);
} // namespace p2pool
+16 -7
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -119,15 +119,17 @@ indexed_hash::indexed_hash(const hash& h)
p2.second = 1;
}
else {
if (n > INDEX_MASK) {
const uint32_t index = (bucket << BUCKET_SHIFT) | n;
if ((n > INDEX_MASK) || (index == std::numeric_limits<uint32_t>::max())) {
LOGERR(0, "fatal error: storage overflow");
PANIC_STOP();
}
m_index = (bucket << BUCKET_SHIFT) | n;
m_index = index;
if (n == d1.capacity()) {
const uint32_t new_capacity = static_cast<uint32_t>(std::min<size_t>(n + ((n + 3) / 4), INDEX_MASK + 1));
const uint32_t new_capacity = static_cast<uint32_t>(std::min<size_t>(n + (n / 4) + 1, INDEX_MASK + 1));
d1.reserve(new_capacity);
d2.reserve(new_capacity);
}
@@ -142,7 +144,7 @@ indexed_hash::~indexed_hash()
decref(m_index);
}
indexed_hash::indexed_hash(const indexed_hash& h)
indexed_hash::indexed_hash(const indexed_hash& h) noexcept
{
const uint32_t i = h.m_index;
@@ -150,7 +152,7 @@ indexed_hash::indexed_hash(const indexed_hash& h)
incref(i);
}
indexed_hash& indexed_hash::operator=(const indexed_hash& h)
indexed_hash& indexed_hash::operator=(const indexed_hash& h) noexcept
{
if (this == &h) {
return *this;
@@ -171,7 +173,7 @@ indexed_hash& indexed_hash::operator=(const indexed_hash& h)
return *this;
}
indexed_hash& indexed_hash::operator=(indexed_hash&& h)
indexed_hash& indexed_hash::operator=(indexed_hash&& h) noexcept
{
if (this == &h) {
return *this;
@@ -219,6 +221,13 @@ hash indexed_hash::get(uint32_t index)
bool indexed_hash::is_same(uint32_t index, uint32_t bucket, const hash& h)
{
#ifdef P2POOL_DEBUGGING
if ((index >> BUCKET_SHIFT) != bucket) {
LOGERR(0, "fatal error: bucket doesn't match index");
PANIC_STOP();
}
#endif
const auto& d1 = storage1[bucket];
index &= INDEX_MASK;
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+87 -47
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -41,7 +41,8 @@ struct CurlContext : public nocopy_nomove
return reinterpret_cast<CurlContext*>(ctx)->on_timer(multi, timeout_ms);
}
static size_t write_func(const void* buffer, size_t size, size_t count, void* ctx)
// cppcheck-suppress constParameterCallback
static size_t write_func(char* buffer, size_t size, size_t count, void* ctx)
{
return reinterpret_cast<CurlContext*>(ctx)->on_write(buffer, size, count);
}
@@ -49,15 +50,13 @@ struct CurlContext : public nocopy_nomove
int on_socket(CURL* easy, curl_socket_t s, int action);
int on_timer(CURLM* multi, long timeout_ms);
static void on_timeout(uv_handle_t* req);
static void on_timeout(uv_timer_t* req);
size_t on_write(const void* buffer, size_t size, size_t count);
size_t on_write(const char* buffer, size_t size, size_t count);
static void curl_perform(uv_poll_t* req, int status, int events);
void check_multi_info();
static void on_close(uv_handle_t* h);
void shutdown();
std::vector<std::pair<curl_socket_t, uv_poll_t*>> m_pollHandles;
@@ -66,7 +65,7 @@ struct CurlContext : public nocopy_nomove
CallbackBase* m_closeCallback;
uv_loop_t* m_loop;
uv_timer_t m_timer;
uv_timer_t* m_timer;
CURLM* m_multiHandle;
CURL* m_handle;
@@ -88,7 +87,7 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
: m_callback(cb)
, m_closeCallback(close_cb)
, m_loop(loop)
, m_timer{}
, m_timer(nullptr)
, m_multiHandle(nullptr)
, m_handle(nullptr)
, m_req(req)
@@ -97,8 +96,6 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
, m_connectedTime(0)
, m_proxy(proxy)
{
BACKGROUND_JOB_START(CurlContext);
m_pollHandles.reserve(2);
{
@@ -132,18 +129,10 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
m_url = buf;
}
int err = uv_timer_init(m_loop, &m_timer);
if (err) {
LOGERR(1, "uv_timer_init failed, error " << uv_err_name(err));
throw std::runtime_error("uv_timer_init failed");
}
m_timer.data = this;
m_multiHandle = curl_multi_init();
if (!m_multiHandle) {
static constexpr char msg[] = "curl_multi_init() failed";
LOGERR(1, msg);
uv_close(reinterpret_cast<uv_handle_t*>(&m_timer), nullptr);
throw std::runtime_error(msg);
}
@@ -153,6 +142,7 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
if (r != CURLM_OK) { \
static constexpr char msg[] = "curl_multi_setopt(" #__VA_ARGS__ ") failed"; \
LOGERR(1, msg << ": " << curl_multi_strerror(r)); \
curl_multi_cleanup(m_multiHandle); \
throw std::runtime_error(msg); \
} \
} while (0)
@@ -168,7 +158,6 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
static constexpr char msg[] = "curl_easy_init() failed";
LOGERR(1, msg);
curl_multi_cleanup(m_multiHandle);
uv_close(reinterpret_cast<uv_handle_t*>(&m_timer), nullptr);
throw std::runtime_error(msg);
}
@@ -178,6 +167,9 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
if (r != CURLE_OK) { \
static constexpr char msg[] = "curl_easy_setopt(" #__VA_ARGS__ ") failed"; \
LOGERR(1, msg << ": " << curl_easy_strerror(r)); \
curl_easy_cleanup(m_handle); \
curl_multi_cleanup(m_multiHandle); \
curl_slist_free_all(m_headers); \
throw std::runtime_error(msg); \
} \
} while (0)
@@ -194,7 +186,11 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
#endif
curl_easy_setopt_checked(m_handle, CURLOPT_URL, m_url.c_str());
curl_easy_setopt_checked(m_handle, CURLOPT_POSTFIELDS, m_req.c_str());
if (!m_req.empty()) {
curl_easy_setopt_checked(m_handle, CURLOPT_POSTFIELDS, m_req.c_str());
}
curl_easy_setopt_checked(m_handle, CURLOPT_CONNECTTIMEOUT, timeout);
curl_easy_setopt_checked(m_handle, CURLOPT_TIMEOUT, timeout * 10);
@@ -223,7 +219,7 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
curl_easy_setopt_checked(m_handle, CURLOPT_SSL_VERIFYHOST, 0L);
if (!ssl_fingerprint.empty()) {
char buf[64] = {};
char buf[128] = {};
log::Stream s(buf);
s << "sha256//" << ssl_fingerprint;
@@ -232,15 +228,32 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
}
#endif
m_timer = new uv_timer_t{};
const int err = uv_timer_init(m_loop, m_timer);
if (err) {
LOGERR(1, "uv_timer_init failed, error " << uv_err_name(err));
delete m_timer;
curl_easy_cleanup(m_handle);
curl_multi_cleanup(m_multiHandle);
curl_slist_free_all(m_headers);
throw std::runtime_error("uv_timer_init failed");
}
m_timer->data = this;
CURLMcode curl_err = curl_multi_add_handle(m_multiHandle, m_handle);
if (curl_err != CURLM_OK) {
LOGERR(1, "curl_multi_add_handle failed: " << curl_multi_strerror(curl_err));
curl_easy_cleanup(m_handle);
curl_multi_cleanup(m_multiHandle);
uv_close(reinterpret_cast<uv_handle_t*>(&m_timer), nullptr);
curl_slist_free_all(m_headers);
uv_close(reinterpret_cast<uv_handle_t*>(m_timer), [](uv_handle_t* h) { delete reinterpret_cast<uv_timer_t*>(h); });
throw std::runtime_error("curl_multi_add_handle failed");
}
BACKGROUND_JOB_START(CurlContext);
m_startTime = microseconds_since_epoch();
}
@@ -251,7 +264,12 @@ CurlContext::~CurlContext()
if (m_error.empty() && !m_response.empty()) {
const uint64_t t = (m_proxy.empty() && m_connectedTime) ? m_connectedTime : microseconds_since_epoch();
tcp_ping = static_cast<double>(t - m_startTime) / 1000.0;
(*m_callback)(m_response.data(), m_response.size(), tcp_ping);
try {
(*m_callback)(m_response.data(), m_response.size(), tcp_ping);
}
catch (...) {
}
}
delete m_callback;
@@ -264,10 +282,13 @@ CurlContext::~CurlContext()
}
}
(*m_closeCallback)(m_error.c_str(), m_error.length(), tcp_ping);
delete m_closeCallback;
try {
(*m_closeCallback)(m_error.c_str(), m_error.length(), tcp_ping);
}
catch (...) {
}
curl_slist_free_all(m_headers);
delete m_closeCallback;
BACKGROUND_JOB_STOP(CurlContext);
}
@@ -348,12 +369,17 @@ int CurlContext::on_socket(CURL* /*easy*/, curl_socket_t s, int action)
int CurlContext::on_timer(CURLM* /*multi*/, long timeout_ms)
{
if (!m_timer) {
LOGERR(1, "on_timer: timer is not initialized/already destroyed");
return -1;
}
if (timeout_ms < 0) {
uv_timer_stop(&m_timer);
uv_timer_stop(m_timer);
return 0;
}
const int result = uv_timer_start(&m_timer, reinterpret_cast<uv_timer_cb>(on_timeout), timeout_ms, 0);
const int result = uv_timer_start(m_timer, on_timeout, timeout_ms, 0);
if (result < 0) {
LOGERR(1, "uv_timer_start failed with error " << uv_err_name(result));
return -1;
@@ -362,7 +388,7 @@ int CurlContext::on_timer(CURLM* /*multi*/, long timeout_ms)
return 0;
}
void CurlContext::on_timeout(uv_handle_t* req)
void CurlContext::on_timeout(uv_timer_t* req)
{
CurlContext* ctx = reinterpret_cast<CurlContext*>(req->data);
@@ -379,15 +405,14 @@ void CurlContext::on_timeout(uv_handle_t* req)
}
}
size_t CurlContext::on_write(const void* buffer, size_t size, size_t count)
size_t CurlContext::on_write(const char* buffer, size_t size, size_t count)
{
if (!m_connectedTime) {
m_connectedTime = microseconds_since_epoch();
}
const size_t realsize = size * count;
const char* p = reinterpret_cast<const char*>(buffer);
m_response.insert(m_response.end(), p, p + realsize);
m_response.insert(m_response.end(), buffer, buffer + realsize);
return realsize;
}
@@ -452,23 +477,15 @@ void CurlContext::check_multi_info()
curl_multi_remove_handle(m_multiHandle, m_handle);
curl_easy_cleanup(m_handle);
curl_multi_cleanup(m_multiHandle);
m_handle = nullptr;
m_multiHandle = nullptr;
return;
}
}
}
void CurlContext::on_close(uv_handle_t* h)
{
CurlContext* ctx = reinterpret_cast<CurlContext*>(h->data);
h->data = nullptr;
if (ctx->m_timer.data) {
return;
}
delete ctx;
}
void CurlContext::shutdown()
{
for (const auto& p : m_pollHandles) {
@@ -477,8 +494,27 @@ void CurlContext::shutdown()
}
m_pollHandles.clear();
if (m_timer.data && !uv_is_closing(reinterpret_cast<uv_handle_t*>(&m_timer))) {
uv_close(reinterpret_cast<uv_handle_t*>(&m_timer), on_close);
if (m_timer->data && !uv_is_closing(reinterpret_cast<uv_handle_t*>(m_timer))) {
if (m_handle) {
if (m_multiHandle) {
curl_multi_remove_handle(m_multiHandle, m_handle);
}
curl_easy_cleanup(m_handle);
m_handle = nullptr;
}
if (m_multiHandle) {
curl_multi_cleanup(m_multiHandle);
m_multiHandle = nullptr;
}
curl_slist_free_all(m_headers);
uv_close(reinterpret_cast<uv_handle_t*>(m_timer), [](uv_handle_t* h) {
CurlContext* ctx = reinterpret_cast<CurlContext*>(h->data);
delete reinterpret_cast<uv_timer_t*>(h);
delete ctx;
});
}
}
@@ -496,7 +532,11 @@ void Call(const std::string& address, int port, const std::string& req, const st
}
catch (const std::exception& e) {
const char* msg = e.what();
(*close_cb)(msg, strlen(msg), 0.0);
try {
(*close_cb)(msg, strlen(msg), 0.0);
}
catch (...) {
}
delete cb;
delete close_cb;
}
+2 -2
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ FORCEINLINE void call(const std::string& address, int port, const std::string& r
typedef Callback<void, const char*, size_t, double>::Derived<T> CallbackT;
typedef Callback<void, const char*, size_t, double>::Derived<U> CallbackU;
Call(address, port, req, auth, proxy, ssl, ssl_fingerprint, new CallbackT(std::move(cb)), new CallbackU(std::move(close_cb)), loop);
Call(address, port, req, auth, proxy, ssl, ssl_fingerprint, new CallbackT(std::forward<T>(cb)), new CallbackU(std::forward<U>(close_cb)), loop);
}
} // namespace JSONRPCRequest
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+4 -3
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,14 +25,14 @@ namespace ConstexprKeccak
template<int ROUNDS>
static FORCEINLINE constexpr void keccakf(std::array<uint64_t, 25>& st)
{
constexpr uint64_t round_constants[24] =
constexpr uint64_t round_constants[24] =
{
0x0000000000000001, 0x0000000000008082, 0x800000000000808a,
0x8000000080008000, 0x000000000000808b, 0x0000000080000001,
0x8000000080008081, 0x8000000000008009, 0x000000000000008a,
0x0000000000000088, 0x0000000080008009, 0x000000008000000a,
0x000000008000808b, 0x800000000000008b, 0x8000000000008089,
0x8000000000008003, 0x8000000000008002, 0x8000000000000080,
0x8000000000008003, 0x8000000000008002, 0x8000000000000080,
0x000000000000800a, 0x800000008000000a, 0x8000000080008081,
0x8000000000008080, 0x0000000080000001, 0x8000000080008008
};
@@ -107,6 +107,7 @@ static constexpr hash keccak(const char (&input)[len])
constexpr hash keccak_0x00 = keccak("\0");
constexpr hash keccak_subaddress_viewpub = keccak("subaddress_viewpub");
constexpr hash keccak_onion_address_v3 = keccak("onion_address_v3");
constexpr hash keccak_i2p_b32_address = keccak("i2p_b32_address");
static_assert(keccak_0x00.u64<0>() == 0x14281E7A9E7836BCULL, "constexpr keccak code check failed");
+106 -88
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@
#include "common.h"
#include "uv_util.h"
#include "wallet.h"
#include "params.h"
#include <ctime>
#include <fstream>
#include <thread>
@@ -118,26 +119,37 @@ public:
BUF_SIZE = SLOT_SIZE * 8192,
};
FORCEINLINE Worker()
FORCEINLINE explicit Worker(const Params& p)
: m_writePos(0)
, m_readPos(0)
, m_stopped(false)
, m_needReopen(false)
, m_consoleLogEnabled(p.m_consoleLogEnabled)
, m_logFileEnabled(p.m_logFileEnabled)
, m_logFileLastStatTime(0)
, m_workerWaiting(false)
{
#if defined(_WIN32) && defined(_MSC_VER) && !defined(NDEBUG)
SetUnhandledExceptionFilter(UnhandledExceptionFilter);
#endif
set_main_thread();
std::setlocale(LC_ALL, "C");
std::setlocale(LC_ALL, "en_001");
m_logFilePath = DATA_DIR + log_file_name;
m_logFilePath = p.m_logFilePath.empty() ? (p.m_dataDir + log_file_name) : p.m_logFilePath;
m_buf.resize(BUF_SIZE);
uv_cond_init(&m_cond);
uv_mutex_init(&m_mutex);
int err = uv_cond_init(&m_cond);
if (err) {
fprintf(stderr, "failed to init m_cond in the logger thread (%s), aborting\n", uv_err_name(err));
abort();
}
err = uv_mutex_init(&m_mutex);
if (err) {
fprintf(stderr, "failed to init m_mutex in the logger thread (%s), aborting\n", uv_err_name(err));
abort();
}
#ifdef _WIN32
SetConsoleMode(hStdIn, ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_EXTENDED_FLAGS);
@@ -153,9 +165,7 @@ public:
CONSOLE_COLORS = false;
}
init_uv_threadpool();
const int err = uv_thread_create(&m_worker, run_wrapper, this);
err = uv_thread_create(&m_worker, run_wrapper, this);
if (err) {
fprintf(stderr, "failed to start logger thread (%s), aborting\n", uv_err_name(err));
abort();
@@ -187,34 +197,37 @@ public:
uv_cond_destroy(&m_cond);
uv_mutex_destroy(&m_mutex);
m_logFile.close();
if (m_logFileEnabled) {
m_logFile.close();
}
}
FORCEINLINE void write(const char* buf, uint32_t size)
{
if (m_writePos.load() - m_readPos > BUF_SIZE - SLOT_SIZE * 16) {
// Buffer is full, can't log normally
if (size > 3) {
fwrite(buf + 3, 1, size - 3, stderr);
}
return;
}
uint32_t writePos = m_writePos.load(std::memory_order_relaxed);
do {
if (writePos - m_readPos.load(std::memory_order_relaxed) > BUF_SIZE - SLOT_SIZE) {
// Buffer is full, can't log normally
if ((size > 3) && m_consoleLogEnabled) {
fwrite(buf + 3, 1, size - 3, stderr);
}
return;
}
} while (!m_writePos.compare_exchange_weak(writePos, writePos + SLOT_SIZE, std::memory_order_acq_rel, std::memory_order_relaxed));
const uint32_t writePos = m_writePos.fetch_add(SLOT_SIZE);
char* p = m_buf.data() + (writePos % BUF_SIZE);
memcpy(p + 1, buf + 1, size - 1);
// Ensure memory order in the writer thread
#ifndef DEV_WITH_TSAN
std::atomic_thread_fence(std::memory_order_seq_cst);
#endif
// Mark that everything is written into this log slot
p[0] = static_cast<char>(buf[0] + 1);
std::atomic<char>* severity = reinterpret_cast<std::atomic<char>*>(p);
severity->store(static_cast<char>(buf[0] + 1), std::memory_order_release);
// Signal the worker thread
uv_cond_signal(&m_cond);
if (m_workerWaiting.load(std::memory_order_relaxed)) {
uv_cond_signal(&m_cond);
}
}
const std::string& log_file_path() const { return m_logFilePath; }
@@ -222,37 +235,20 @@ public:
FORCEINLINE void schedule_reopen()
{
m_needReopen = true;
uv_cond_signal(&m_cond);
// Signal the worker thread
if (m_workerWaiting.load(std::memory_order_relaxed)) {
uv_cond_signal(&m_cond);
}
}
private:
static void init_uv_threadpool()
{
#ifdef _MSC_VER
#define putenv _putenv
#endif
const uint32_t N = std::min(std::max(std::thread::hardware_concurrency(), 4U), 8U);
static char buf[40] = {};
log::Stream s(buf);
s << "UV_THREADPOOL_SIZE=" << N << '\0';
int err = putenv(buf);
if (err != 0) {
err = errno;
fprintf(stderr, "Couldn't set UV thread pool size to %u threads, putenv returned error %d\n", N, err);
}
static uv_work_t dummy;
err = uv_queue_work(uv_default_loop_checked(), &dummy, [](uv_work_t*) {}, nullptr);
if (err) {
fprintf(stderr, "init_uv_threadpool: uv_queue_work failed, error %s\n", uv_err_name(err));
}
}
bool reopen(struct stat& st)
{
if (!m_logFileEnabled) {
return true;
}
st = {};
if (m_logFile.is_open()) {
@@ -273,7 +269,6 @@ private:
return true;
}
private:
static void run_wrapper(void* arg) { reinterpret_cast<Worker*>(arg)->run(); }
NOINLINE void run()
@@ -282,21 +277,24 @@ private:
struct stat log_file_st;
if (!reopen(log_file_st)) {
if (!reopen(log_file_st) && m_consoleLogEnabled) {
fprintf(stderr, "failed to open %s: error %d\n", m_logFilePath.c_str(), errno);
}
do {
uv_mutex_lock(&m_mutex);
if (m_readPos == m_writePos.load()) {
// Nothing to do, wait for the signal or exit if stopped
if (m_stopped) {
uv_mutex_unlock(&m_mutex);
return;
{
MutexLock lock(m_mutex);
if (m_readPos.load(std::memory_order_relaxed) == m_writePos.load(std::memory_order_acquire)) {
if (m_stopped) {
return;
}
m_workerWaiting.store(true, std::memory_order_relaxed);
uv_cond_wait(&m_cond, &m_mutex);
m_workerWaiting.store(false, std::memory_order_relaxed);
}
uv_cond_wait(&m_cond, &m_mutex);
}
uv_mutex_unlock(&m_mutex);
bool expected = true;
if (m_needReopen.compare_exchange_strong(expected, false)) {
@@ -306,23 +304,20 @@ private:
}
}
for (uint32_t writePos = m_writePos.load(); m_readPos != writePos; writePos = m_writePos.load()) {
for (uint32_t writePos = m_writePos.load(std::memory_order_acquire); m_readPos.load(std::memory_order_relaxed) != writePos; writePos = m_writePos.load(std::memory_order_acquire)) {
// We have at least one log slot pending, possibly more than one
// Process everything in a loop before reading m_writePos again
do {
char* p = m_buf.data() + (m_readPos % BUF_SIZE);
char* p = m_buf.data() + (m_readPos.load(std::memory_order_relaxed) % BUF_SIZE);
// Wait until everything is written into this log slot
volatile char& severity = p[0];
while (!severity) {
std::atomic<char>* severity_ptr = reinterpret_cast<std::atomic<char>*>(p);
char severity;
while (!(severity = severity_ptr->load(std::memory_order_acquire))) {
std::this_thread::yield();
}
// Ensure memory order in the reader thread
#ifndef DEV_WITH_TSAN
std::atomic_thread_fence(std::memory_order_seq_cst);
#endif
uint32_t size = static_cast<uint8_t>(p[2]);
size = (size << 8) + static_cast<uint8_t>(p[1]);
@@ -337,9 +332,11 @@ private:
strip_colors(p, size);
}
fwrite(p, 1, size, (severity == 1) ? stdout : stderr);
if (m_consoleLogEnabled) {
fwrite(p, 1, size, (severity == 1) ? stdout : stderr);
}
if (m_logFile.is_open()) {
if (m_logFileEnabled && m_logFile.is_open()) {
if (c) {
strip_colors(p, size);
}
@@ -359,28 +356,37 @@ private:
}
// Mark this log slot empty
severity = '\0';
severity_ptr->store('\0', std::memory_order_relaxed);
m_readPos += SLOT_SIZE;
} while (m_readPos != writePos);
// fetch_add returns the pre-increment value; "+ SLOT_SIZE" gives us the new m_readPos
} while (m_readPos.fetch_add(SLOT_SIZE, std::memory_order_relaxed) + SLOT_SIZE != writePos);
}
// Flush the log file only after all pending log lines have been written
if (m_logFile.is_open()) {
if (m_logFileEnabled && m_logFile.is_open()) {
m_logFile.flush();
// Automatically reopen the file if either it
// no longer exists or it is now a different
// regular file; this detects manual moving or
// recreating of the file
struct stat buf;
if (stat(m_logFilePath.c_str(), &buf) == 0) {
if(log_file_st.st_dev && log_file_st.st_ino && S_ISREG(buf.st_mode) &&
(buf.st_dev != log_file_st.st_dev || buf.st_ino != log_file_st.st_ino)) {
// Throttle this check to once per 500 ms
const uint64_t now = microseconds_since_epoch();
if (now >= m_logFileLastStatTime + 500'000) {
m_logFileLastStatTime = now;
struct stat buf;
if (stat(m_logFilePath.c_str(), &buf) == 0) {
if (log_file_st.st_dev && log_file_st.st_ino && S_ISREG(buf.st_mode) &&
(buf.st_dev != log_file_st.st_dev || buf.st_ino != log_file_st.st_ino)) {
reopen(log_file_st);
}
}
else if (errno == ENOENT) {
reopen(log_file_st);
}
} else if(errno == ENOENT) {
reopen(log_file_st);
}
}
@@ -429,6 +435,11 @@ private:
std::ofstream m_logFile;
std::string m_logFilePath;
bool m_consoleLogEnabled;
bool m_logFileEnabled;
uint64_t m_logFileLastStatTime;
std::atomic<bool> m_workerWaiting;
};
static Worker* worker = nullptr;
@@ -478,16 +489,20 @@ NOINLINE Writer::~Writer()
m_buf[2] = static_cast<char>(static_cast<uint8_t>(size >> 8));
m_buf[m_pos] = '\n';
#ifndef P2POOL_LOG_DISABLE
worker->write(m_buf, size);
if (worker) {
worker->write(m_buf, size);
}
#endif
}
void start()
void start(const Params& p)
{
#ifndef P2POOL_LOG_DISABLE
worker = new Worker();
worker = new Worker(p);
LOGINFO(0, "started");
#else
(void)p;
#endif
}
@@ -495,10 +510,13 @@ void reopen()
{
// This will trigger the worker thread which will then reopen log file if it's been moved
#ifndef P2POOL_LOG_DISABLE
worker->schedule_reopen();
if (worker) {
worker->schedule_reopen();
}
#endif
}
// Called from main() after everything else is already shut down and destroyed, so no thread races here
void stop()
{
#ifndef P2POOL_LOG_DISABLE
+6 -5
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@
namespace p2pool {
class Wallet;
struct Params;
namespace log {
@@ -82,9 +83,9 @@ struct Stream
const bool negative = is_negative(data);
std::make_unsigned_t<T> udata = abs(data);
char buf[32];
char buf[80];
size_t k = sizeof(buf);
int w = m_numberWidth;
int w = std::min<int>(m_numberWidth, static_cast<int>(sizeof(buf)));
do {
buf[--k] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+/"[udata % base];
@@ -277,7 +278,7 @@ template<> struct Stream::Entry<difficulty_type>
{
char buf[40];
size_t k = sizeof(buf);
int w = wrapper->m_numberWidth;
int w = std::min<int>(wrapper->m_numberWidth, sizeof(buf));
uint64_t a = data.lo;
uint64_t b = data.hi;
@@ -622,7 +623,7 @@ struct DummyStream
#endif
void start();
void start(const Params& p);
void reopen();
void stop();
+104 -55
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -38,7 +38,6 @@
#endif // WITH_GRPC
#include <filesystem>
#include <fstream>
#ifdef WITH_RANDOMX
#include "randomx.h"
@@ -72,6 +71,10 @@ void p2pool_usage()
"--light-mode Don't allocate RandomX dataset, saves 2GB of RAM\n"
"--loglevel Verbosity of the log, integer number between 0 and %d\n"
"--data-dir Path to store general p2pool files (log, cache, peer data, etc.), default is current directory\n"
"--log-file Path to the log file, default is \"p2pool.log\" in p2pool's working directory\n"
"--no-console-log Disable logging to the console\n"
"--no-log-file Disable logging to the file\n"
"--disable-log Equivalent to --no-console-log --no-log-file, disables logging entirely and saves ~8 MB of memory\n"
"--sidechain-config Name of the p2pool sidechain parameters file (only use it if you run your own sidechain)\n"
"--data-api Path to the p2pool JSON data (use it in tandem with an external web-server). Not affected by --data-dir setting!\n"
"--local-api Enable /local/ path in api path for Stratum Server and built-in miner statistics\n"
@@ -89,6 +92,7 @@ void p2pool_usage()
"--no-autodiff Disable automatic difficulty adjustment for miners connected to stratum (WARNING: incompatible with Nicehash and MRR)\n"
"--rpc-login Specify username[:password] required for Monero RPC server\n"
"--socks5 Specify IP:port of a SOCKS5 proxy to use for outgoing connections\n"
"--socks5-proxy-type The type of SOCKS5 proxy. Can be one of the following values: auto, plain, tor, i2p. Default is auto (auto-detected by the port number)\n"
"--no-dns Disable DNS queries, use only IP addresses to connect to peers (seed node DNS will be unavailable too)\n"
"--p2p-external-port Port number that your router uses for mapping to your local p2p port. Use it if you are behind a NAT and still want to accept incoming connections\n"
#ifdef WITH_UPNP
@@ -104,10 +108,14 @@ void p2pool_usage()
"--rpc-ssl Enable SSL on RPC connections to the Monero node\n"
"--rpc-ssl-fingerprint base64-encoded fingerprint of the Monero node's certificate (optional, use it for certificate pinning)\n"
#endif
"--stratum-proxy-protocol Enable HAProxy PROXY protocol v2 for incoming Stratum connections (use with HAProxy send-proxy-v2)\n"
"--p2p-proxy-protocol Enable HAProxy PROXY protocol v2 for incoming P2P connections (use with HAProxy send-proxy-v2)\n"
"--no-stratum-http Disable HTTP on Stratum ports\n"
"--full-validation Enables full share validation / increases CPU usage\n"
"--onion-address Tell other peers to use this .onion address to connect to this node through TOR\n"
"--i2p-address Tell other peers to use this .b32.i2p address to connect to this node through I2P\n"
"--no-clearnet-p2p Forces P2P server to listen on 127.0.0.1 and to not connect to clearnet IPs\n"
"--params-file File name to load parameters from. It can't be used together with any other command line parameters\n"
"--help Show this help message\n\n"
"Example command line:\n\n"
"%s --host 127.0.0.1 --rpc-port 18081 --zmq-port 18083 --wallet YOUR_WALLET_ADDRESS --stratum 0.0.0.0:%d --p2p 0.0.0.0:%d\n\n",
@@ -222,6 +230,56 @@ int p2pool_test()
return 0;
}
static p2pool::Params get_params(int argc, const char* const argv[]) noexcept
{
try {
std::vector<std::vector<std::string>> args;
args.reserve(argc);
// Group command-line parameters by the pattern "--name [data1 data2 ... data_n]"
// Each parameter starting with "--" can have 0 or more values attached to it
for (int i = 1; i < argc; ++i) {
std::string_view arg = argv[i];
if ((arg.size() > 2) && (arg[0] == '-') && (arg[1] == '-')) {
// Store the parameter name without the "--" prefix
arg.remove_prefix(2);
args.emplace_back(1, std::string(arg));
}
else if (!args.empty()) {
args.back().emplace_back(std::move(arg));
}
}
p2pool::Params params(args);
if (params.valid()) {
return params;
}
}
catch (const std::exception&) {
}
printf("Invalid or missing command line. Try \"p2pool --help\".\n");
abort();
}
static p2pool::Params get_params(const std::string& params_file) noexcept
{
try {
p2pool::Params params(p2pool::parse_config(params_file));
if (params.valid()) {
return params;
}
}
catch (const std::exception&) {
}
printf("Invalid or missing command line. Try \"p2pool --help\".\n");
abort();
}
int main(int argc, char* argv[])
{
if (argc == 1) {
@@ -229,11 +287,10 @@ int main(int argc, char* argv[])
return 0;
}
bool is_mini = false;
bool is_nano = false;
std::string params_file;
for (int i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "/help") || !strcmp(argv[i], "-h") || !strcmp(argv[i], "/h")) {
if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "/help") || !strcmp(argv[i], "-h") || !strcmp(argv[i], "/h") || !strcmp(argv[i], "/?")) {
p2pool_usage();
return 0;
}
@@ -247,53 +304,17 @@ int main(int argc, char* argv[])
return p2pool_test();
}
if ((strcmp(argv[i], "--data-dir") == 0) && (i + 1 < argc)) {
std::string path = argv[++i];
p2pool::DATA_DIR = std::move(path);
p2pool::fixup_path(p2pool::DATA_DIR);
}
if (!strcmp(argv[i], "--mini")) is_mini = true;
if (!strcmp(argv[i], "--nano")) is_nano = true;
}
// If the data directory is not set, check if P2Pool has write access to the current directory
// If it doesn't, switch to user's home directory
if (p2pool::DATA_DIR.empty()) {
std::ofstream f("p2pool.tmp");
if (f && f.put(' ')) {
f.close();
std::remove("p2pool.tmp");
}
else {
char buf[1024];
size_t size = sizeof(buf);
if (uv_os_homedir(buf, &size) == 0) {
p2pool::DATA_DIR.assign(buf, size);
p2pool::fixup_path(p2pool::DATA_DIR);
p2pool::DATA_DIR += ".p2pool/";
if (is_mini) {
p2pool::DATA_DIR += "mini/";
}
else if (is_nano) {
p2pool::DATA_DIR += "nano/";
}
}
if (!strcmp(argv[i], "--params-file") && (i + 1 < argc)) {
params_file = argv[++i];
}
}
if (!p2pool::DATA_DIR.empty()) {
printf("Using \"%s\" for P2Pool files\n", p2pool::DATA_DIR.c_str());
if (!params_file.empty() && (argc != 3)) {
fprintf(stderr, "--params-file can't be combined with other command line parameters\n");
return 1;
}
// Try to create it if it doesn't exist
if (!p2pool::DATA_DIR.empty()) {
std::error_code err;
std::filesystem::create_directories(p2pool::DATA_DIR, err);
}
p2pool::set_main_thread();
#if defined(_WIN32) && defined(_MSC_VER) && !defined(NDEBUG)
SymInitialize(GetCurrentProcess(), NULL, TRUE);
@@ -303,20 +324,42 @@ int main(int argc, char* argv[])
memory_tracking_start();
// Create default loop here
uv_default_loop();
int result;
{
p2pool::log::start();
// Create the default libuv loop and initialize libuv here
// It will call the important stuff like WSAStartup and many other things
// Some P2Pool code will not work without libuv initialized, so the code above this line must be minimal
p2pool::init_uv();
const p2pool::Params params = params_file.empty() ? get_params(argc, argv) : get_params(params_file);
if (!params.m_dataDir.empty()) {
printf("Using \"%s\" for P2Pool files\n", params.m_dataDir.c_str());
// Try to create it if it doesn't exist
std::error_code err;
std::filesystem::create_directories(params.m_dataDir, err);
}
if (params.m_consoleLogEnabled || params.m_logFileEnabled) {
p2pool::log::start(params);
}
else {
p2pool::log::GLOBAL_LOG_LEVEL = -1;
}
p2pool::init_crypto_cache();
int result = static_cast<int>(curl_global_init_mem(CURL_GLOBAL_ALL, p2pool::malloc_hook, p2pool::free_hook, p2pool::realloc_hook, p2pool::strdup_hook, p2pool::calloc_hook));
result = static_cast<int>(curl_global_init_mem(CURL_GLOBAL_ALL, p2pool::malloc_hook, p2pool::free_hook, p2pool::realloc_hook, p2pool::strdup_hook, p2pool::calloc_hook));
if (result != CURLE_OK) {
return result;
}
#ifdef WITH_GRPC
grpc_init();
if (params.grpc_needed()) {
grpc_init();
}
#endif
#ifdef WITH_TLS
@@ -327,7 +370,7 @@ int main(int argc, char* argv[])
#endif
try {
p2pool::p2pool pool(argc, argv);
p2pool::p2pool pool(params);
result = pool.run();
}
catch (...) {
@@ -335,7 +378,9 @@ int main(int argc, char* argv[])
}
#ifdef WITH_GRPC
grpc_shutdown();
if (params.grpc_needed()) {
grpc_shutdown();
}
#endif
curl_global_cleanup();
@@ -346,7 +391,9 @@ int main(int argc, char* argv[])
p2pool::indexed_hash::cleanup_storage();
#endif
p2pool::log::stop();
if (params.m_consoleLogEnabled || params.m_logFileEnabled) {
p2pool::log::stop();
}
uv_loop_close(uv_default_loop());
@@ -354,6 +401,8 @@ int main(int argc, char* argv[])
uv_library_shutdown();
#endif
}
if (!memory_tracking_stop()) {
result = 1;
}
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+264 -2
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,10 +23,19 @@
#include "merge_mining_client_tari.h"
#endif
LOG_CATEGORY(MergeMiningClient)
#include "p2pool.h"
#include "params.h"
#include "pool_block.h"
#include "keccak_constexpr.h"
#include "side_chain.h"
#include "merkle.h"
static thread_local const char* log_category_prefix = "MergeMiningClient ";
namespace p2pool {
static constexpr hash Tari_ChainID{ "01f0cf665bd4cd31cbb2b2470236389c483522b350335e10a4a5dca34cb85990" };
IMergeMiningClient* IMergeMiningClient::create(p2pool* pool, const std::string& host, const std::string& wallet) noexcept
{
try {
@@ -43,4 +52,257 @@ IMergeMiningClient* IMergeMiningClient::create(p2pool* pool, const std::string&
return nullptr;
}
MergeMiningClientShared::MergeMiningClientShared(p2pool* pool, const std::string& wallet)
: m_chainParamsLock{}
, m_chainParams{}
, m_chainParamsTimestamp(0)
, m_auxWallet(wallet)
, m_pool(pool)
, m_previousAuxHashes{}
, m_previousAuxHashesIndex(0)
, m_previousAuxHashesFoundIndex(std::numeric_limits<uint32_t>::max())
{
uv_rwlock_init_checked(&m_chainParamsLock);
}
MergeMiningClientShared::~MergeMiningClientShared()
{
uv_rwlock_destroy(&m_chainParamsLock);
}
void MergeMiningClientShared::on_external_block(const PoolBlock& block)
{
#ifdef WITH_MERGE_MINING_DONATION
// The rest of the code is needed only when this node is sending donation messages
if (m_pool->params().m_authorKeyFile.empty()) {
return;
}
const char* old_log_category_prefix = log_category_prefix;
log_category_prefix = get_log_category();
ON_SCOPE_LEAVE([old_log_category_prefix]() { log_category_prefix = old_log_category_prefix; });
// Sanity check
if (block.m_transactions.empty() || block.m_hashingBlob.empty() || (block.m_hashingBlob.size() > 128)) {
LOGWARN(3, "on_external_block: sanity check failed - " << block.m_transactions.size() << " transactions, hashing blob size = " << block.m_hashingBlob.size());
return;
}
ChainParameters chain_params;
hash previous_aux_hashes[NUM_PREVIOUS_HASHES];
{
ReadLock lock(m_chainParamsLock);
chain_params = m_chainParams;
std::copy(m_previousAuxHashes, m_previousAuxHashes + NUM_PREVIOUS_HASHES, previous_aux_hashes);
}
// Don't continue if our aux chain is not there
if (block.m_mergeMiningExtra.find(chain_params.aux_id) == block.m_mergeMiningExtra.end()) {
return;
}
// All aux chains in this block + the P2Pool sidechain
std::vector<hash> aux_ids;
// All aux chains in this block
std::vector<AuxChainData> aux_chains;
aux_ids.reserve(block.m_mergeMiningExtra.size() + 1);
aux_chains.reserve(block.m_mergeMiningExtra.size() + 1);
uint64_t mm_extra_size = 0;
for (const auto& i : block.m_mergeMiningExtra) {
// Filter aux chain data only
if ((i.first == keccak_subaddress_viewpub) || (i.first == keccak_onion_address_v3) || (i.first == keccak_i2p_b32_address)) {
continue;
}
++mm_extra_size;
hash data;
difficulty_type diff;
{
const std::vector<uint8_t>& v = i.second;
if (v.size() < HASH_SIZE) {
LOGWARN(3, "on_external_block: sanity check failed - invalid merge mining extra data " << '1');
return;
}
const uint8_t* p = v.data();
const uint8_t* e = v.data() + v.size();
memcpy(data.h, p, HASH_SIZE);
p += HASH_SIZE;
p = readVarint(p, e, diff.lo);
if (!p) {
LOGWARN(3, "on_external_block: sanity check failed - invalid merge mining extra data " << '2');
diff.lo = 0;
}
else {
p = readVarint(p, e, diff.hi);
if (!p) {
LOGWARN(3, "on_external_block: sanity check failed - invalid merge mining extra data " << '3');
diff.hi = 0;
}
}
}
// If it's our aux chain, check that it's the same job and that there is enough PoW
if (i.first == chain_params.aux_id) {
const bool different_hash = (data != chain_params.aux_hash);
if (different_hash || (diff != chain_params.aux_diff)) {
uint32_t index = std::numeric_limits<uint32_t>::max();
if (different_hash) {
for (uint32_t k = 0; k < NUM_PREVIOUS_HASHES; ++k) {
if (previous_aux_hashes[k] == data) {
index = k;
break;
}
}
}
m_previousAuxHashesFoundIndex = index;
if (different_hash && (index == std::numeric_limits<uint32_t>::max())) {
LOGINFO(4, "External aux job solution found, but it's for another miner");
return;
}
LOGINFO(4, "External aux job solution found, but it's stale");
chain_params.aux_hash = data;
chain_params.aux_diff = diff;
}
else {
m_previousAuxHashesFoundIndex = std::numeric_limits<uint32_t>::max();
}
if (!diff.check_pow(block.m_powHash)) {
#ifndef P2POOL_LOG_DISABLE
const char* name = ((chain_params.aux_id == Tari_ChainID) ? "Tari" : "aux");
#endif
LOGINFO(4, "External aux job solution found, but it doesn't have enough PoW (block diff = " << block.m_difficulty << ", " << name << " diff = " << diff << ')');
return;
}
}
aux_ids.emplace_back(i.first);
aux_chains.emplace_back(i.first, data, diff);
}
aux_ids.emplace_back(m_pool->side_chain().consensus_hash());
LOGINFO(0, log::LightGreen() << "External aux job solution found. Processing it!");
// coinbase_merkle_proof
root_hash root;
std::vector<hash> proof;
uint32_t path;
#ifdef WITH_INDEXED_HASHES
std::vector<hash> transactions;
transactions.reserve(block.m_transactions.size());
for (const auto& h : block.m_transactions) {
transactions.emplace_back(h);
}
#else
const std::vector<hash>& transactions = block.m_transactions;
#endif
if (!merkle_hash_with_proof(transactions, 0, proof, path, root)) {
LOGWARN(3, "on_external_block: merkle_hash_with_proof failed for coinbase transaction");
return;
}
if (!verify_merkle_proof(transactions[0], proof, path, root)) {
LOGWARN(3, "on_external_block: verify_merkle_proof failed for coinbase transaction");
return;
}
std::vector<uint8_t> coinbase_merkle_proof;
coinbase_merkle_proof.reserve(proof.size() * HASH_SIZE);
for (const hash& h : proof) {
coinbase_merkle_proof.insert(coinbase_merkle_proof.end(), h.h, h.h + HASH_SIZE);
}
// hashing_blob
uint8_t hashing_blob[128] = {};
memcpy(hashing_blob, block.m_hashingBlob.data(), block.m_hashingBlob.size());
// nonce_offset and blob
size_t header_size = 0;
const std::vector<uint8_t> blob = block.serialize_mainchain_data(&header_size);
if (header_size <= NONCE_SIZE) {
LOGWARN(3, "on_external_block: invalid header_size");
return;
}
const uint32_t nonce_offset = static_cast<uint32_t>(header_size - NONCE_SIZE);
// aux_merkle_proof, aux_merkle_proof_path
std::vector<hash> aux_merkle_proof;
uint32_t aux_merkle_proof_path = 0;
const hash sidechain_id = block.m_sidechainId;
const uint32_t n_aux_chains = static_cast<uint32_t>(mm_extra_size + 1);
std::vector<hash> hashes(n_aux_chains);
uint32_t aux_nonce;
if (!find_aux_nonce(aux_ids, aux_nonce, 1000)) {
LOGWARN(3, "on_external_block: failed to find aux_nonce");
return;
}
for (const AuxChainData& aux_data : aux_chains) {
const uint32_t aux_slot = get_aux_slot(aux_data.unique_id, aux_nonce, n_aux_chains);
if (!hashes[aux_slot].empty()) {
LOGWARN(3, "on_external_block: found an incorrect aux_nonce " << '1');
return;
}
hashes[aux_slot] = aux_data.data;
}
const uint32_t aux_slot = get_aux_slot(m_pool->side_chain().consensus_hash(), aux_nonce, n_aux_chains);
if (!hashes[aux_slot].empty()) {
LOGWARN(3, "on_external_block: found an incorrect aux_nonce " << '2');
return;
}
hashes[aux_slot] = sidechain_id;
if (!merkle_hash_with_proof(hashes, chain_params.aux_hash, aux_merkle_proof, aux_merkle_proof_path, root)) {
LOGWARN(3, "on_external_block: merkle_hash_with_proof failed for the aux hash");
return;
}
if (root != block.m_merkleRoot) {
LOGWARN(3, "on_external_block: merkle root didn't match");
return;
}
if (!verify_merkle_proof(chain_params.aux_hash, aux_merkle_proof, aux_merkle_proof_path, root)) {
LOGWARN(3, "on_external_block: verify_merkle_proof failed for the aux hash");
return;
}
submit_solution(coinbase_merkle_proof, hashing_blob, nonce_offset, block.m_seed, blob, aux_merkle_proof, aux_merkle_proof_path);
#else // WITH_MERGE_MINING_DONATION
(void)block;
#endif // WITH_MERGE_MINING_DONATION
}
} // namespace p2pool
+33 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,6 +17,8 @@
#pragma once
#include "uv_util.h"
namespace p2pool {
class p2pool;
@@ -53,4 +55,34 @@ public:
virtual void api_status(log::Stream&) const = 0;
};
class MergeMiningClientShared : public IMergeMiningClient, public nocopy_nomove
{
public:
MergeMiningClientShared(p2pool* pool, const std::string& wallet);
~MergeMiningClientShared() override;
void on_external_block(const PoolBlock& block) override;
virtual const char* get_log_category() const = 0;
protected:
mutable uv_rwlock_t m_chainParamsLock;
ChainParameters m_chainParams;
uint64_t m_chainParamsTimestamp;
std::string m_auxWallet;
p2pool* m_pool;
enum {
NUM_PREVIOUS_HASHES = 8,
};
hash m_previousAuxHashes[NUM_PREVIOUS_HASHES];
uint32_t m_previousAuxHashesIndex;
std::atomic<uint32_t> m_previousAuxHashesFoundIndex;
};
} // namespace p2pool
+49 -25
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,12 +29,9 @@ LOG_CATEGORY(MergeMiningClientJSON_RPC)
namespace p2pool {
MergeMiningClientJSON_RPC::MergeMiningClientJSON_RPC(p2pool* pool, const std::string& host, const std::string& wallet)
: m_host(host)
: MergeMiningClientShared(pool, wallet)
, m_host(host)
, m_port(80)
, m_chainParamsTimestamp(0)
, m_auxWallet(wallet)
, m_ping(0.0)
, m_pool(pool)
, m_loop{}
, m_loopThread{}
, m_timer{}
@@ -44,6 +41,13 @@ MergeMiningClientJSON_RPC::MergeMiningClientJSON_RPC(p2pool* pool, const std::st
const size_t k = host.find_last_of(':');
if (k != std::string::npos) {
m_host = host.substr(0, k);
// Handle IPv6 addresses
if ((m_host.length() > 2) && (m_host.find_first_of(':') != std::string::npos) && (m_host.front() == '[') && (m_host.back() == ']')) {
m_host.erase(m_host.begin());
m_host.pop_back();
}
m_port = static_cast<int32_t>(std::stol(host.substr(k + 1), nullptr, 10));
}
@@ -77,8 +81,6 @@ MergeMiningClientJSON_RPC::MergeMiningClientJSON_RPC(p2pool* pool, const std::st
}
m_timer.data = this;
uv_rwlock_init_checked(&m_lock);
err = uv_thread_create(&m_loopThread, loop, this);
if (err) {
LOGERR(1, "failed to start event loop thread, error " << uv_err_name(err));
@@ -94,8 +96,6 @@ MergeMiningClientJSON_RPC::~MergeMiningClientJSON_RPC()
uv_async_send(&m_shutdownAsync);
uv_thread_join(&m_loopThread);
uv_rwlock_destroy(&m_lock);
LOGINFO(1, "stopped");
}
@@ -115,15 +115,14 @@ void MergeMiningClientJSON_RPC::merge_mining_get_chain_id()
JSONRPCRequest::call(m_host, m_port, req, std::string(), m_pool->params().m_socks5Proxy, false, std::string(),
[this](const char* data, size_t size, double ping) {
WriteLock lock(m_lock);
WriteLock lock(m_chainParamsLock);
if (parse_merge_mining_get_chain_id(data, size)) {
if (ping > 0.0) {
m_ping = ping;
}
LOGINFO(1, m_host << ':' << m_port << " uses chain_id " << log::LightCyan() << m_chainParams.aux_id);
LOGINFO(1, m_host << ':' << m_port << " ping is " << m_ping << " ms");
if (ping > 0.0) {
LOGINFO(1, m_host << ':' << m_port << " ping is " << ping << " ms");
}
// Chain ID received successfully, we can start polling for new mining jobs now
const int err = uv_timer_start(&m_timer, on_timer, 0, 500);
@@ -191,7 +190,7 @@ void MergeMiningClientJSON_RPC::merge_mining_get_aux_block(uint64_t height, cons
hash aux_hash;
{
ReadLock lock(m_lock);
ReadLock lock(m_chainParamsLock);
aux_hash = m_chainParams.aux_hash;
}
@@ -207,14 +206,29 @@ void MergeMiningClientJSON_RPC::merge_mining_get_aux_block(uint64_t height, cons
bool changed = false;
hash chain_id;
hash prev_aux_hash;
std::vector<uint8_t> prev_aux_blob;
{
WriteLock lock(m_lock);
WriteLock lock(m_chainParamsLock);
prev_aux_hash = m_chainParams.aux_hash;
prev_aux_blob = m_chainParams.aux_blob;
if (parse_merge_mining_get_aux_block(data, size, changed)) {
chain_id = m_chainParams.aux_id;
}
}
if (changed && !chain_id.empty()) {
{
WriteLock lock(m_chainParamsLock);
const uint32_t index = (m_previousAuxHashesIndex++) % NUM_PREVIOUS_HASHES;
m_previousAuxHashes[index] = prev_aux_hash;
m_previousAuxBlobs[index] = prev_aux_blob;
}
m_pool->update_aux_data(chain_id);
}
},
@@ -293,14 +307,19 @@ bool MergeMiningClientJSON_RPC::parse_merge_mining_get_aux_block(const char* dat
void MergeMiningClientJSON_RPC::submit_solution(const std::vector<uint8_t>& /*coinbase_merkle_proof*/, const uint8_t (&/*hashing_blob*/)[128], size_t /*nonce_offset*/, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path)
{
ReadLock lock(m_lock);
ReadLock lock(m_chainParamsLock);
std::vector<char> buf((m_chainParams.aux_blob.size() + HASH_SIZE + blob.size()) * 2 + merkle_proof.size() * (HASH_SIZE * 2 + 3) + 256);
const uint32_t index = m_previousAuxHashesFoundIndex.exchange(std::numeric_limits<uint32_t>::max());
const std::vector<uint8_t>& aux_blob = (index < NUM_PREVIOUS_HASHES) ? m_previousAuxBlobs[index] : m_chainParams.aux_blob;
const hash& aux_hash = (index < NUM_PREVIOUS_HASHES) ? m_previousAuxHashes[index] : m_chainParams.aux_hash;
std::vector<char> buf((aux_blob.size() + HASH_SIZE + blob.size()) * 2 + merkle_proof.size() * (HASH_SIZE * 2 + 3) + 256);
log::Stream s(buf.data(), buf.size());
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"merge_mining_submit_solution\",\"params\":{"
<< "\"aux_blob\":\"" << log::hex_buf(m_chainParams.aux_blob.data(), m_chainParams.aux_blob.size()) << '"'
<< ",\"aux_hash\":\"" << m_chainParams.aux_hash << '"'
<< "\"aux_blob\":\"" << log::hex_buf(aux_blob.data(), aux_blob.size()) << '"'
<< ",\"aux_hash\":\"" << aux_hash << '"'
<< ",\"blob\":\"" << log::hex_buf(blob.data(), blob.size()) << '"'
<< ",\"merkle_proof\":[";
@@ -329,7 +348,7 @@ void MergeMiningClientJSON_RPC::submit_solution(const std::vector<uint8_t>& /*co
void MergeMiningClientJSON_RPC::print_status() const
{
ReadLock lock(m_lock);
ReadLock lock(m_chainParamsLock);
LOGINFO(0, "status" <<
"\nHost = " << m_host << ':' << m_port <<
@@ -340,7 +359,7 @@ void MergeMiningClientJSON_RPC::print_status() const
void MergeMiningClientJSON_RPC::api_status(log::Stream& s) const
{
ReadLock lock(m_lock);
ReadLock lock(m_chainParamsLock);
s << '{'
<< "\"api\":\"JSON RPC\","
@@ -356,7 +375,7 @@ bool MergeMiningClientJSON_RPC::get_params(ChainParameters& out_params) const
{
const uint64_t t = seconds_since_epoch();
ReadLock lock(m_lock);
ReadLock lock(m_chainParamsLock);
if (m_chainParams.aux_id.empty() || m_chainParams.aux_diff.empty()) {
return false;
@@ -448,4 +467,9 @@ void MergeMiningClientJSON_RPC::on_shutdown()
uv_close(reinterpret_cast<uv_handle_t*>(&m_timer), nullptr);
}
const char* MergeMiningClientJSON_RPC::get_log_category() const
{
return log_category_prefix;
}
} // namespace p2pool
+6 -14
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,19 +24,20 @@ namespace p2pool {
class p2pool;
struct PoolBlock;
class MergeMiningClientJSON_RPC : public IMergeMiningClient
class MergeMiningClientJSON_RPC : public MergeMiningClientShared
{
public:
MergeMiningClientJSON_RPC(p2pool* pool, const std::string& host, const std::string& wallet);
~MergeMiningClientJSON_RPC() override;
bool get_params(ChainParameters& out_params) const override;
void on_external_block(const PoolBlock& /*block*/) override {}
void submit_solution(const std::vector<uint8_t>& coinbase_merkle_proof, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) override;
void print_status() const override;
void api_status(log::Stream&) const override;
const char* get_log_category() const override;
private:
static void loop(void* data);
@@ -51,20 +52,11 @@ private:
bool parse_merge_mining_submit_solution(const char* data, size_t size) const;
std::vector<uint8_t> m_previousAuxBlobs[NUM_PREVIOUS_HASHES];
std::string m_host;
int32_t m_port;
mutable uv_rwlock_t m_lock;
ChainParameters m_chainParams;
uint64_t m_chainParamsTimestamp;
std::string m_auxWallet;
double m_ping;
p2pool* m_pool;
uv_loop_t m_loop;
uv_thread_t m_loopThread;
+24 -244
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,15 +34,9 @@ using namespace tari::rpc;
namespace p2pool {
MergeMiningClientTari::MergeMiningClientTari(p2pool* pool, std::string host, const std::string& wallet)
: m_chainParams{}
, m_chainParamsTimestamp(0)
, m_previousAuxHashes{}
, m_previousAuxHashesIndex(0)
, m_previousAuxHashesFoundIndex(std::numeric_limits<uint32_t>::max())
, m_auxWallet(wallet)
, m_pool(pool)
: MergeMiningClientShared(pool, wallet)
, m_tariJobParams{}
, m_server(new TariServer(pool->params().m_socks5Proxy))
, m_server(new TariServer(pool->params().m_socks5Proxy, pool->params().m_socks5ProxyType))
, m_hostStr(host)
, m_workerStop(0)
, m_pushBlockStop(0)
@@ -78,8 +72,6 @@ MergeMiningClientTari::MergeMiningClientTari(p2pool* pool, std::string host, con
throw std::exception();
}
uv_rwlock_init_checked(&m_chainParamsLock);
if (!m_server->start()) {
throw std::exception();
}
@@ -89,7 +81,7 @@ MergeMiningClientTari::MergeMiningClientTari(p2pool* pool, std::string host, con
s << "127.0.0.1:" << m_server->external_listen_port();
m_channelArgs.SetInt(GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS, 1000);
m_channelArgs.SetInt(GRPC_ARG_MIN_RECONNECT_BACKOFF_MS, 1000);
m_channelArgs.SetInt(GRPC_ARG_MAX_RECONNECT_BACKOFF_MS, 10000);
@@ -102,15 +94,15 @@ MergeMiningClientTari::MergeMiningClientTari(p2pool* pool, std::string host, con
uv_mutex_init_checked(&m_workerLock);
uv_cond_init_checked(&m_workerCond);
uv_mutex_init_checked(&m_pushBlockLock);
uv_cond_init_checked(&m_pushBlockCond);
int err = uv_thread_create(&m_worker, run_wrapper, this);
if (err) {
LOGERR(1, "failed to start worker thread, error " << uv_err_name(err));
throw std::exception();
}
uv_mutex_init_checked(&m_pushBlockLock);
uv_cond_init_checked(&m_pushBlockCond);
std::ifstream f("tari_nodes.txt");
if (f.is_open()) {
@@ -170,8 +162,6 @@ MergeMiningClientTari::~MergeMiningClientTari()
m_TariNode.reset();
m_channel.reset();
uv_rwlock_destroy(&m_chainParamsLock);
uv_mutex_destroy(&m_workerLock);
uv_cond_destroy(&m_workerCond);
@@ -207,230 +197,6 @@ bool MergeMiningClientTari::get_params(ChainParameters& out_params) const
return true;
}
void MergeMiningClientTari::on_external_block(const PoolBlock& block)
{
#ifdef WITH_MERGE_MINING_DONATION
// The rest of the code is needed only when this node is sending donation messages
if (m_pool->params().m_authorKeyFile.empty()) {
return;
}
// Sanity check
if (block.m_transactions.empty() || block.m_hashingBlob.empty() || (block.m_hashingBlob.size() > 128)) {
LOGWARN(3, "on_external_block: sanity check failed - " << block.m_transactions.size() << " transactions, hashing blob size = " << block.m_hashingBlob.size());
return;
}
ChainParameters chain_params;
uint64_t previous_aux_hashes[NUM_PREVIOUS_HASHES];
{
ReadLock lock(m_chainParamsLock);
chain_params = m_chainParams;
memcpy(previous_aux_hashes, m_previousAuxHashes, sizeof(m_previousAuxHashes));
}
// Don't continue if our aux chain is not there
if (block.m_mergeMiningExtra.find(chain_params.aux_id) == block.m_mergeMiningExtra.end()) {
return;
}
// All aux chains in this block + the P2Pool sidechain
std::vector<hash> aux_ids;
// All aux chains in this block
std::vector<AuxChainData> aux_chains;
aux_ids.reserve(block.m_mergeMiningExtra.size() + 1);
aux_chains.reserve(block.m_mergeMiningExtra.size() + 1);
uint64_t mm_extra_size = 0;
for (const auto& i : block.m_mergeMiningExtra) {
// Filter aux chain data only
if ((i.first == keccak_subaddress_viewpub) || (i.first == keccak_onion_address_v3)) {
continue;
}
++mm_extra_size;
hash data;
difficulty_type diff;
{
const std::vector<uint8_t>& v = i.second;
const uint8_t* p = v.data();
const uint8_t* e = v.data() + v.size();
if (p + HASH_SIZE > e) {
LOGWARN(3, "on_external_block: sanity check failed - invalid merge mining extra data " << '1');
return;
}
memcpy(data.h, p, HASH_SIZE);
p += HASH_SIZE;
p = readVarint(p, e, diff.lo);
if (!p) {
LOGWARN(3, "on_external_block: sanity check failed - invalid merge mining extra data " << '2');
diff.lo = 0;
}
else {
p = readVarint(p, e, diff.hi);
if (!p) {
LOGWARN(3, "on_external_block: sanity check failed - invalid merge mining extra data " << '3');
diff.hi = 0;
}
}
}
// If it's our aux chain, check that it's the same job and that there is enough PoW
if (i.first == chain_params.aux_id) {
if ((data != chain_params.aux_hash) || (diff != chain_params.aux_diff)) {
uint32_t index = std::numeric_limits<uint32_t>::max();
for (uint32_t k = 0; k < NUM_PREVIOUS_HASHES; ++k) {
if (previous_aux_hashes[k] == *data.u64()) {
index = k;
break;
}
}
m_previousAuxHashesFoundIndex = index;
if (index == std::numeric_limits<uint32_t>::max()) {
LOGINFO(4, "External aux job solution found, but it's for another miner");
return;
}
LOGINFO(4, "External aux job solution found, but it's stale");
chain_params.aux_hash = data;
chain_params.aux_diff = diff;
}
else {
m_previousAuxHashesFoundIndex = std::numeric_limits<uint32_t>::max();
}
if (!diff.check_pow(block.m_powHash)) {
LOGINFO(4, "External aux job solution found, but it doesn't have enough PoW (block diff = " << block.m_difficulty << ", Tari diff = " << diff << ')');
return;
}
}
aux_ids.emplace_back(i.first);
aux_chains.emplace_back(i.first, data, diff);
}
aux_ids.emplace_back(m_pool->side_chain().consensus_hash());
LOGINFO(0, log::LightGreen() << "External aux job solution found. Processing it!");
// coinbase_merkle_proof
root_hash root;
std::vector<hash> proof;
uint32_t path;
#ifdef WITH_INDEXED_HASHES
std::vector<hash> transactions;
transactions.reserve(block.m_transactions.size());
for (const auto& h : block.m_transactions) {
transactions.emplace_back(h);
}
#else
const std::vector<hash>& transactions = block.m_transactions;
#endif
if (!merkle_hash_with_proof(transactions, 0, proof, path, root)) {
LOGWARN(3, "on_external_block: merkle_hash_with_proof failed for coinbase transaction");
return;
}
if (!verify_merkle_proof(transactions[0], proof, path, root)) {
LOGWARN(3, "on_external_block: verify_merkle_proof failed for coinbase transaction");
return;
}
std::vector<uint8_t> coinbase_merkle_proof;
coinbase_merkle_proof.reserve(proof.size() * HASH_SIZE);
for (const hash& h : proof) {
coinbase_merkle_proof.insert(coinbase_merkle_proof.end(), h.h, h.h + HASH_SIZE);
}
// hashing_blob
uint8_t hashing_blob[128] = {};
memcpy(hashing_blob, block.m_hashingBlob.data(), block.m_hashingBlob.size());
// nonce_offset and blob
size_t header_size = 0;
const std::vector<uint8_t> blob = block.serialize_mainchain_data(&header_size);
if (header_size <= NONCE_SIZE) {
LOGWARN(3, "on_external_block: invalid header_size");
return;
}
const uint32_t nonce_offset = static_cast<uint32_t>(header_size - NONCE_SIZE);
// aux_merkle_proof, aux_merkle_proof_path
std::vector<hash> aux_merkle_proof;
uint32_t aux_merkle_proof_path = 0;
const hash sidechain_id = block.m_sidechainId;
const uint32_t n_aux_chains = static_cast<uint32_t>(mm_extra_size + 1);
std::vector<hash> hashes(n_aux_chains);
uint32_t aux_nonce;
if (!find_aux_nonce(aux_ids, aux_nonce, 1000)) {
LOGWARN(3, "on_external_block: failed to find aux_nonce");
return;
}
for (const AuxChainData& aux_data : aux_chains) {
const uint32_t aux_slot = get_aux_slot(aux_data.unique_id, aux_nonce, n_aux_chains);
if (!hashes[aux_slot].empty()) {
LOGWARN(3, "on_external_block: found an incorrect aux_nonce " << '1');
return;
}
hashes[aux_slot] = aux_data.data;
}
const uint32_t aux_slot = get_aux_slot(m_pool->side_chain().consensus_hash(), aux_nonce, n_aux_chains);
if (!hashes[aux_slot].empty()) {
LOGWARN(3, "on_external_block: found an incorrect aux_nonce " << '2');
return;
}
hashes[aux_slot] = sidechain_id;
if (!merkle_hash_with_proof(hashes, chain_params.aux_hash, aux_merkle_proof, aux_merkle_proof_path, root)) {
LOGWARN(3, "on_external_block: merkle_hash_with_proof failed for the aux hash");
return;
}
if (root != block.m_merkleRoot) {
LOGWARN(3, "on_external_block: merkle root didn't match");
return;
}
if (!verify_merkle_proof(chain_params.aux_hash, aux_merkle_proof, aux_merkle_proof_path, root)) {
LOGWARN(3, "on_external_block: verify_merkle_proof failed for the aux hash");
return;
}
submit_solution(coinbase_merkle_proof, hashing_blob, nonce_offset, block.m_seed, blob, aux_merkle_proof, aux_merkle_proof_path);
#else // WITH_MERGE_MINING_DONATION
(void) block;
#endif // WITH_MERGE_MINING_DONATION
}
void MergeMiningClientTari::submit_solution(const std::vector<uint8_t>& coinbase_merkle_proof, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path)
{
Block block;
@@ -820,7 +586,7 @@ void MergeMiningClientTari::run()
const uint32_t index = (m_previousAuxHashesIndex++) % NUM_PREVIOUS_HASHES;
m_previousAuxHashes[index] = *m_chainParams.aux_hash.u64();
m_previousAuxHashes[index] = m_chainParams.aux_hash;
m_previousTariBlocks[index] = std::move(m_tariBlock);
std::copy(mm_hash.begin(), mm_hash.end(), m_chainParams.aux_hash.h);
@@ -863,8 +629,8 @@ void MergeMiningClientTari::run()
// TariServer and TariClient are simply a proxy from a localhost TCP port to the external Tari node
// This is needed for SOCKS5 proxy support (gRPC library doesn't support it natively)
MergeMiningClientTari::TariServer::TariServer(const std::string& socks5Proxy)
: TCPServer(1, MergeMiningClientTari::TariClient::allocate, socks5Proxy)
MergeMiningClientTari::TariServer::TariServer(const std::string& socks5Proxy, Params::ProxyType socks5ProxyType)
: TCPServer(1, MergeMiningClientTari::TariClient::allocate, socks5Proxy, socks5ProxyType)
, m_TariNodeIsV6(false)
, m_TariNodeHost()
, m_TariNodePort(0)
@@ -1085,6 +851,8 @@ void MergeMiningClientTari::push_blocks_to(const std::string& node_address)
LOGINFO(4, node_address << " is at block height " << tip_info.metadata().best_block_height());
}
std::string prev_header_hash;
while (!m_pushBlockStop) {
Block block;
{
@@ -1099,6 +867,13 @@ void MergeMiningClientTari::push_blocks_to(const std::string& node_address)
}
const std::string& h = block.header().hash();
// Don't push the same block twice
if (h == prev_header_hash) {
continue;
}
prev_header_hash = h;
LOGINFO(4, "Pushing block " << log::hex_buf(h.data(), h.size()) << " to " << node_address);
grpc::ClientContext ctx;
@@ -1119,4 +894,9 @@ void MergeMiningClientTari::push_blocks_to(const std::string& node_address)
}
}
const char* MergeMiningClientTari::get_log_category() const
{
return log_category_prefix;
}
} // namespace p2pool
+5 -20
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ namespace p2pool {
class p2pool;
struct PoolBlock;
class MergeMiningClientTari : public IMergeMiningClient, public nocopy_nomove
class MergeMiningClientTari : public MergeMiningClientShared
{
public:
MergeMiningClientTari(p2pool* pool, std::string host, const std::string& wallet);
@@ -34,33 +34,18 @@ public:
static constexpr char TARI_PREFIX[] = "tari://";
bool get_params(ChainParameters& out_params) const override;
void on_external_block(const PoolBlock& block) override;
void submit_solution(const std::vector<uint8_t>& coinbase_merkle_proof, const uint8_t (&hashing_blob)[128], size_t nonce_offset, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path) override;
void print_status() const override;
void api_status(log::Stream&) const override;
const char* get_log_category() const override;
private:
mutable uv_rwlock_t m_chainParamsLock;
ChainParameters m_chainParams;
uint64_t m_chainParamsTimestamp;
enum {
NUM_PREVIOUS_HASHES = 8,
};
uint64_t m_previousAuxHashes[NUM_PREVIOUS_HASHES];
tari::rpc::Block m_previousTariBlocks[NUM_PREVIOUS_HASHES];
uint32_t m_previousAuxHashesIndex;
std::atomic<uint32_t> m_previousAuxHashesFoundIndex;
tari::rpc::Block m_tariBlock;
std::string m_auxWallet;
p2pool* m_pool;
struct TariJobParams
{
uint64_t height;
@@ -83,7 +68,7 @@ private:
struct TariServer : public TCPServer
{
explicit TariServer(const std::string& socks5Proxy);
TariServer(const std::string& socks5Proxy, Params::ProxyType socks5ProxyType);
~TariServer() {}
[[nodiscard]] bool start();
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+164 -33
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -33,6 +33,7 @@
#include "rapidjson_wrapper.h"
#include "merge_mining_client.h"
#include "sha256.h"
#include "i2p.h"
#ifdef WITH_TLS
#include <openssl/curve25519.h>
@@ -48,9 +49,10 @@ LOG_CATEGORY(P2PServer)
static constexpr char saved_peer_list_file_name[] = "p2pool_peers.txt";
static constexpr char saved_onion_peer_list_file_name[] = "p2pool_onion_peers.txt";
static const char* seed_nodes[] = { "seeds.p2pool.io", "main.p2poolpeers.net", "main.gupax.io", "" };
static const char* seed_nodes_mini[] = { "seeds-mini.p2pool.io", "mini.p2poolpeers.net", "mini.gupax.io", "" };
static const char* seed_nodes_nano[] = { "seeds-nano.p2pool.io", "nano.p2poolpeers.net", "nano.gupax.io", ""};
static constexpr char saved_i2p_peer_list_file_name[] = "p2pool_i2p_peers.txt";
static const char* seed_nodes[] = { "seeds.p2pool.io", "main.p2poolpeers.net", "" };
static const char* seed_nodes_mini[] = { "seeds-mini.p2pool.io", "mini.p2poolpeers.net", "" };
static const char* seed_nodes_nano[] = { "seeds-nano.p2pool.io", "nano.p2poolpeers.net", ""};
static constexpr int DEFAULT_BACKLOG = 16;
static constexpr uint64_t DEFAULT_BAN_TIME = 600;
@@ -63,10 +65,16 @@ static constexpr hash seed_onion_nodes[] = {
from_onion_v3_const("p2pseedtwyepi4crkf4akceen4twejcptnsbm6gjmzdfgxua57hiijid.onion")
};
static constexpr hash seed_i2p_nodes[] = {
from_i2p_b32_const("p2pseeds2ggmpw62wdua6ll27awcndorshcg7nsbinc5xlhp6tqa.b32.i2p"),
from_i2p_b32_const("p2pse3irgfuks5eazbcwkcijsv6u3qtffl6zudct4t4kn2sinotq.b32.i2p"),
from_i2p_b32_const("h6jrh53yvlvzqqyy7abzjp2t4kidtheee7e7nfbynecroc7yvbjq.b32.i2p")
};
P2PServer::P2PServer(p2pool* pool)
: TCPServer(DEFAULT_BACKLOG, P2PClient::allocate, pool->params().m_socks5Proxy)
: TCPServer(DEFAULT_BACKLOG, P2PClient::allocate, pool->params().m_socks5Proxy, pool->params().m_socks5ProxyType, pool->params().m_p2pProxyProtocol)
, m_pool(pool)
, m_cache(pool->params().m_blockCache ? new BlockCache() : nullptr)
, m_cache(pool->params().m_blockCache ? new BlockCache(pool->params()) : nullptr)
, m_cacheLoaded(false)
, m_initialPeerList(pool->params().m_p2pPeerList)
, m_cachedBlocks(nullptr)
@@ -79,6 +87,8 @@ P2PServer::P2PServer(p2pool* pool)
, m_seenGoodPeers(false)
, m_peerListLastSaved(0)
, m_numOnionConnections(0)
, m_numI2PConnections(0)
, m_isI2P(pool->params().m_socks5ProxyType == Params::ProxyType::I2P)
, m_lookForMissingBlocks(true)
, m_fastestPeer(nullptr)
, m_newP2PoolVersionDetected(false)
@@ -93,8 +103,10 @@ P2PServer::P2PServer(p2pool* pool)
// Diffuse the initial state in case it has low quality
m_rng.discard(10000);
m_peerId = m_rng();
m_peerId_TOR = m_rng();
// Make sure peer IDs are not 0
do { m_peerId = m_rng(); } while (!m_peerId);
do { m_peerId_TOR = m_rng(); } while (!m_peerId_TOR);
do { m_peerId_I2P = m_rng(); } while (!m_peerId_I2P);
const Params& params = pool->params();
@@ -426,14 +438,16 @@ void P2PServer::update_peer_connections()
uint32_t num_outgoing = m_numConnections - m_numIncomingConnections;
// Try to have at least N/2 outgoing onion connections
if (!m_socks5Proxy.empty()) {
// Try to have at least N/2 (or N if clearnet P2P is disabled) outgoing onion connections
if (!m_socks5Proxy.empty() && (m_socks5ProxyType == Params::ProxyType::TOR)) {
std::vector<hash> pubkeys = m_pool->side_chain().seen_onion_pubkeys();
// Add seed nodes
pubkeys.insert(pubkeys.end(), seed_onion_nodes, seed_onion_nodes + array_size(seed_onion_nodes));
for (uint32_t i = m_numOnionConnections, n = N / 2; (i < n) && !pubkeys.empty();) {
const uint32_t n = m_pool->params().m_noClearnetP2P ? N : (N / 2);
for (uint32_t i = m_numOnionConnections; (i < n) && !pubkeys.empty();) {
const uint64_t k = get_random64() % pubkeys.size();
const std::string addr = to_onion_v3(pubkeys[k]);
@@ -457,6 +471,39 @@ void P2PServer::update_peer_connections()
}
}
// Try to have at least N/2 (or N if clearnet P2P is disabled) outgoing I2P connections
if (!m_socks5Proxy.empty() && (m_socks5ProxyType == Params::ProxyType::I2P)) {
std::vector<hash> dest_hashes = m_pool->side_chain().seen_i2p_dest_hashes();
// Add seed nodes
dest_hashes.insert(dest_hashes.end(), seed_i2p_nodes, seed_i2p_nodes + array_size(seed_i2p_nodes));
const uint32_t n = m_pool->params().m_noClearnetP2P ? N : (N / 2);
for (uint32_t i = m_numI2PConnections; (i < n) && !dest_hashes.empty();) {
const uint64_t k = get_random64() % dest_hashes.size();
const std::string addr = to_i2p_b32(dest_hashes[k]);
int port = DEFAULT_P2P_PORT_I2P;
for (const hash& seed_i2p : seed_i2p_nodes) {
if (dest_hashes[k] == seed_i2p) {
const SideChain& s = m_pool->side_chain();
port = s.is_mini() ? DEFAULT_P2P_PORT_MINI : (s.is_nano() ? DEFAULT_P2P_PORT_NANO : DEFAULT_P2P_PORT);
break;
}
}
if ((connected_clients_domain.find(addr) == connected_clients_domain.end()) && connect_to_peer(addr, port)) {
++i;
++num_outgoing;
}
dest_hashes[k] = dest_hashes.back();
dest_hashes.pop_back();
}
}
// Try to have at least N outgoing connections (N defaults to 10, can be set via --out-peers command line parameter)
if (!m_pool->params().m_noClearnetP2P) {
while ((num_outgoing < N) && !peer_list.empty()) {
@@ -561,7 +608,9 @@ void P2PServer::save_peer_list_async()
void P2PServer::save_peer_list()
{
const std::string path = DATA_DIR + saved_peer_list_file_name;
const Params& params = m_pool->params();
const std::string path = params.m_dataDir + saved_peer_list_file_name;
std::ofstream f(path, std::ios::binary);
@@ -606,7 +655,7 @@ void P2PServer::save_peer_list()
const SideChain& s = m_pool->side_chain();
if (s.onion_pubkeys_count() > 0) {
const std::string onion_path = DATA_DIR + saved_onion_peer_list_file_name;
const std::string onion_path = params.m_dataDir + saved_onion_peer_list_file_name;
f.open(onion_path, std::ios::binary);
@@ -627,6 +676,28 @@ void P2PServer::save_peer_list()
}
}
if (s.i2p_dest_hashes_count() > 0) {
const std::string i2p_path = params.m_dataDir + saved_i2p_peer_list_file_name;
f.open(i2p_path, std::ios::binary);
if (!f.is_open()) {
LOGERR(1, "failed to save I2P peer list " << i2p_path << ": error " << errno);
}
else {
const std::vector<hash> dest_hashes = s.seen_i2p_dest_hashes();
for (const hash& h : dest_hashes) {
f << to_i2p_b32(h) << '\n';
}
f.flush();
f.close();
LOGINFO(5, "I2P peer list saved (" << dest_hashes.size() << " peers)");
}
}
m_peerListLastSaved = seconds_since_epoch();
}
@@ -725,8 +796,27 @@ void P2PServer::load_peer_list()
}
// Finally load peers from p2pool_peers.txt and p2pool_onion_peers.txt
for (size_t i = 0, n = (m_socks5Proxy.empty() ? 1 : 2); i < n; ++i) {
const std::string path = DATA_DIR + (i ? saved_onion_peer_list_file_name : saved_peer_list_file_name);
std::vector<std::string> paths;
paths.resize(Params::ProxyType::MAX);
const Params& params = m_pool->params();
paths[Params::ProxyType::PLAIN] = params.m_dataDir + saved_peer_list_file_name;
if (!m_socks5Proxy.empty() && (m_socks5ProxyType == Params::ProxyType::TOR)) {
paths[Params::ProxyType::TOR] = params.m_dataDir + saved_onion_peer_list_file_name;
}
if (!m_socks5Proxy.empty() && (m_socks5ProxyType == Params::ProxyType::I2P)) {
paths[Params::ProxyType::I2P] = params.m_dataDir + saved_i2p_peer_list_file_name;
}
for (int i = Params::ProxyType::PLAIN; i < Params::ProxyType::MAX; ++i) {
const std::string& path = paths[i];
if (path.empty()) {
continue;
}
std::ifstream f(path);
@@ -738,12 +828,18 @@ void P2PServer::load_peer_list()
std::getline(f, address);
if (!address.empty()) {
if (i > 0) {
if (i == Params::ProxyType::TOR) {
const hash h = from_onion_v3(address);
if (!h.empty()) {
pubkeys.emplace_back(h);
}
}
else if (i == Params::ProxyType::I2P) {
const hash h = from_i2p_b32(address);
if (!h.empty()) {
pubkeys.emplace_back(h);
}
}
else {
if (!saved_list.empty()) {
saved_list += ',';
@@ -754,9 +850,12 @@ void P2PServer::load_peer_list()
}
f.close();
if (i > 0) {
if (i == Params::ProxyType::TOR) {
s.add_onion_pubkeys(pubkeys);
}
else if (i == Params::ProxyType::I2P) {
s.add_i2p_dest_hashes(pubkeys);
}
}
}
@@ -798,6 +897,10 @@ void P2PServer::load_peer_list()
void P2PServer::load_monerod_peer_list()
{
if (m_pool->params().m_noClearnetP2P) {
return;
}
const Params::Host& host = m_pool->current_host();
JSONRPCRequest::call(host.m_address, host.m_rpcPort, "/get_peer_list", host.m_rpcLogin, m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
@@ -1197,13 +1300,17 @@ uint64_t P2PServer::get_random64()
void P2PServer::print_status()
{
const uint64_t onion_list_size = m_pool->side_chain().onion_pubkeys_count();
const uint64_t i2p_list_size = m_pool->side_chain().i2p_dest_hashes_count();
MutexLock lock(m_peerListLock);
LOGINFO(0, "status" <<
"\nConnections = " << m_numConnections.load() << " (" << m_numIncomingConnections.load() << " incoming, " << m_numOnionConnections.load() << " onion)"
"\nConnections = " << m_numConnections.load() <<
" (" << m_numIncomingConnections.load() <<
" incoming, " << m_numOnionConnections.load() << " onion, " << m_numI2PConnections.load() << " I2P)" <<
"\nPeer list size = " << m_peerList.size() <<
"\nOnion list size = " << onion_list_size <<
"\nI2P list size = " << i2p_list_size <<
"\nUptime = " << log::Duration(seconds_since_epoch() - m_pool->start_time())
);
}
@@ -1295,11 +1402,12 @@ void P2PServer::on_timer()
return;
}
++m_timerCounter;
const uint64_t t = ++m_timerCounter;
if (!m_initialPeerList.empty()) {
if ((t == 1) && !m_initialPeerList.empty()) {
connect_to_peers(m_initialPeerList);
m_initialPeerList.clear();
return;
}
flush_cache();
@@ -1892,8 +2000,12 @@ void P2PServer::P2PClient::reset()
if (server->m_fastestPeer == this) {
server->m_fastestPeer = nullptr;
}
if (m_addressType == AddressType::DomainName) {
--server->m_numOnionConnections;
if ((m_addressType == AddressType::DomainName) && m_connectedTime) {
if (server->m_isI2P == true) {
--server->m_numI2PConnections;
} else {
--server->m_numOnionConnections;
}
}
}
@@ -1953,7 +2065,11 @@ bool P2PServer::P2PClient::on_connect()
}
if (m_addressType == AddressType::DomainName) {
++server->m_numOnionConnections;
if (server->m_isI2P == true) {
++server->m_numI2PConnections;
} else {
++server->m_numOnionConnections;
}
}
const uint64_t cur_time = seconds_since_epoch();
@@ -1996,7 +2112,7 @@ bool P2PServer::P2PClient::on_read(const char* data, uint32_t size)
const MessageId id = static_cast<MessageId>(buf[0]);
// Peer must complete the handshake challenge before sending any other messages
if (!m_handshakeComplete && (id != m_expectedMessage)) {
if ((!m_handshakeComplete || m_handshakeInvalid) && (id != m_expectedMessage)) {
LOGWARN(5, "peer " << static_cast<char*>(m_addrString) << " didn't send handshake messages first");
ban(DEFAULT_BAN_TIME);
server->remove_peer_from_list(this);
@@ -2290,7 +2406,17 @@ bool P2PServer::P2PClient::send_handshake_challenge()
k >>= 8;
}
k = owner->get_peerId((m_addressType == AddressType::DomainName) && (strstr(m_addrString, ".onion:")));
bool is_tor = false;
if (((m_addressType == AddressType::DomainName) && (strstr(m_addrString, ".onion:"))) ||
(!owner->m_pool->params().m_onionPubkey.empty() && m_isIncoming && (m_addressType != AddressType::DomainName) && m_addr.is_localhost()))
{
// 1) We're connecting to an .onion address
// 2) We published our .onion address, and it's an incoming connection on localhost interface, so it's likely an incoming tor connection
is_tor = true;
}
k = owner->get_peerId(is_tor, owner->m_isI2P);
memcpy(p, &k, sizeof(uint64_t));
p += sizeof(uint64_t);
@@ -2483,7 +2609,7 @@ bool P2PServer::P2PClient::on_handshake_challenge(const uint8_t* buf)
uint64_t peer_id;
memcpy(&peer_id, buf + CHALLENGE_SIZE, sizeof(uint64_t));
if ((peer_id == server->get_peerId(false)) || (peer_id == server->get_peerId(true))) {
if ((peer_id == server->m_peerId) || (peer_id == server->m_peerId_TOR) || (peer_id == server->m_peerId_I2P)) {
LOGWARN(5, "tried to connect to self at " << static_cast<const char*>(m_addrString));
return false;
}
@@ -2581,7 +2707,7 @@ bool P2PServer::P2PClient::on_listen_port(const uint8_t* buf)
int32_t port;
memcpy(&port, buf, sizeof(port));
if ((port < 0) || (port >= 65536)) {
if ((port <= 0) || (port >= 65536)) {
LOGWARN(5, "peer " << static_cast<char*>(m_addrString) << " sent an invalid listen port number");
return false;
}
@@ -3025,7 +3151,7 @@ bool P2PServer::P2PClient::on_aux_job_donation(const uint8_t* buf, uint32_t size
const time_t cur_time = time(nullptr);
// Layout of the message:
//
//
// 32 bytes | Secondary public key
// 8 bytes | Secondary public key's expiration timestamp
// 64 bytes | Master key signature signing the above 40 bytes
@@ -3044,11 +3170,11 @@ bool P2PServer::P2PClient::on_aux_job_donation(const uint8_t* buf, uint32_t size
}
// Layout of the data:
//
//
// 8 bytes | timestamp
//
//
// Next come one or multiple data entries:
//
//
// 32 bytes | aux_id
// 32 bytes | aux_hash
// 16 bytes | aux_diff
@@ -3095,6 +3221,11 @@ bool P2PServer::P2PClient::on_aux_job_donation(const uint8_t* buf, uint32_t size
p += sizeof(int64_t);
// Ignore outdated messages
if (data_timestamp > std::numeric_limits<int64_t>::max() - AUX_JOB_TIMEOUT) {
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent an invalid AUX_JOB_DONATION message (timestamp = " << data_timestamp << ')');
return false;
}
if (cur_time >= data_timestamp + AUX_JOB_TIMEOUT) {
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent an outdated AUX_JOB_DONATION message (" << cur_time << " >= " << data_timestamp << " + " << static_cast<int>(AUX_JOB_TIMEOUT) << ')');
return true;
@@ -3102,7 +3233,7 @@ bool P2PServer::P2PClient::on_aux_job_donation(const uint8_t* buf, uint32_t size
if ((data_end - p) % DATA_ENTRY_SIZE) {
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent an invalid AUX_JOB_DONATION message (" << (data_end - p) << " is not a multiple of " << DATA_ENTRY_SIZE << ')');
return true;
return false;
}
hash digest;
@@ -3244,7 +3375,7 @@ bool P2PServer::P2PClient::on_monero_block_broadcast(const uint8_t* buf, uint32_
std::vector<uint8_t> blob;
blob.reserve(data.header_size + HASH_SIZE + 2);
blob.insert(blob.end(), buf, buf + data.header_size);
blob.insert(blob.end(), root.h, root.h + HASH_SIZE);
writeVarint(num_transactions + 1, blob);
+8 -4
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -37,6 +37,7 @@ static constexpr int DEFAULT_P2P_PORT_MINI = 37888;
static constexpr int DEFAULT_P2P_PORT_NANO = 37890;
static constexpr int DEFAULT_P2P_PORT_ONION = 28722;
static constexpr int DEFAULT_P2P_PORT_I2P = 28723;
static constexpr uint32_t PROTOCOL_VERSION_1_0 = 0x00010000UL;
static constexpr uint32_t PROTOCOL_VERSION_1_1 = 0x00010001UL;
@@ -95,9 +96,9 @@ public:
// Both peers send handshake challenge immediately after a connection is established
// Both peers must have the same consensus ID for handshake to succeed
// Consensus ID is never sent over the network
//
//
// Handshake sequence:
//
//
// - Both peers send 8-byte random challenges (and 8 bytes of peer ID) to each other
// - Each peer receives 8-byte challenge, chooses 8-byte random SALT and calculates H = KECCAK(CHALLENGE|CONSENSUS_ID|SALT)
// - Both peers send their H and SALT, calculate H of the other peer and check if it matches with what other peer calculated
@@ -191,7 +192,7 @@ public:
void broadcast(const PoolBlock& block, const PoolBlock* parent);
[[nodiscard]] uint64_t get_random64();
[[nodiscard]] uint64_t get_peerId(bool is_tor) const { return is_tor ? m_peerId_TOR : m_peerId; }
[[nodiscard]] uint64_t get_peerId(bool is_tor, bool is_i2p) const { return is_tor ? m_peerId_TOR : (is_i2p ? m_peerId_I2P : m_peerId); }
void print_status() override;
void show_peers_async();
@@ -271,6 +272,7 @@ private:
uint64_t m_peerId;
uint64_t m_peerId_TOR;
uint64_t m_peerId_I2P;
mutable uv_mutex_t m_peerListLock;
@@ -291,6 +293,8 @@ private:
std::atomic<uint64_t> m_peerListLastSaved;
std::atomic<uint32_t> m_numOnionConnections;
std::atomic<uint32_t> m_numI2PConnections;
bool m_isI2P;
uv_mutex_t m_broadcastLock;
uv_async_t m_broadcastAsync;
+47 -80
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -63,8 +63,9 @@ namespace p2pool {
static uint64_t BLOCK_HEADERS_REQUIRED = 720;
p2pool::p2pool(int argc, char* argv[])
p2pool::p2pool(const Params& params)
: m_stopped(false)
, m_params(params)
, m_updateSeed(true)
, m_submitBlockData{}
, m_zmqLastActive(0)
@@ -73,49 +74,33 @@ p2pool::p2pool(int argc, char* argv[])
{
LOGINFO(1, log::LightCyan() << VERSION);
Params* p = new Params(argc, argv);
if (!p->valid()) {
LOGERR(1, "Invalid or missing command line. Try \"p2pool --help\".");
delete p;
throw std::exception();
}
m_params = p;
// P2Pool-nano requires more Monero blocks for the initial sync
if (m_params->m_nano) {
if (m_params.m_nano) {
BLOCK_HEADERS_REQUIRED = 1440;
}
bkg_jobs_tracker = new BackgroundJobTracker();
#ifdef WITH_UPNP
if (p->m_upnp) {
if (m_params.m_upnp) {
init_upnp();
}
#endif
for (Params::Host& h : p->m_hosts) {
if (!h.init_display_name(*p)) {
throw std::exception();
}
}
m_currentHostIndex = 0;
m_hostPing.resize(p->m_hosts.size());
m_hostPing.resize(m_params.m_hosts.size());
hash pub, sec, eph_public_key;
generate_keys(pub, sec);
uint8_t view_tag;
if (!p->m_miningWallet.get_eph_public_key(sec, 0, eph_public_key, view_tag)) {
if (!m_params.m_miningWallet.get_eph_public_key(sec, 0, eph_public_key, view_tag)) {
LOGERR(1, "Invalid wallet address: get_eph_public_key failed");
throw std::exception();
}
const NetworkType type = p->m_miningWallet.type();
const NetworkType type = m_params.m_miningWallet.type();
if (type == NetworkType::Testnet) {
LOGWARN(1, "Mining to a testnet wallet address");
@@ -196,34 +181,17 @@ p2pool::p2pool(int argc, char* argv[])
}
m_timer.data = this;
m_api = p->m_apiPath.empty() ? nullptr : new p2pool_api(p->m_apiPath, p->m_localStats);
m_api = m_params.m_apiPath.empty() ? nullptr : new p2pool_api(m_params.m_apiPath, m_params.m_localStats);
if (p->m_localStats && !m_api) {
if (m_params.m_localStats && !m_api) {
LOGERR(1, "--local-api and --stratum-api command line parameters can't be used without --data-api");
throw std::exception();
}
m_sideChain = new SideChain(this, type, p->m_mini ? "mini" : (p->m_nano ? "nano" : nullptr));
const int p2p_port = m_sideChain->is_mini() ? DEFAULT_P2P_PORT_MINI : (m_sideChain->is_nano() ? DEFAULT_P2P_PORT_NANO : DEFAULT_P2P_PORT);
if (p->m_noClearnetP2P) {
char buf[48] = {};
log::Stream s(buf);
s << "127.0.0.1:" << p2p_port;
p->m_p2pAddresses = buf;
}
else if (p->m_p2pAddresses.empty()) {
char buf[48] = {};
log::Stream s(buf);
s << "[::]:" << p2p_port << ",0.0.0.0:" << p2p_port;
p->m_p2pAddresses = buf;
}
m_sideChain = new SideChain(this, type, m_params.m_mini ? "mini" : (m_params.m_nano ? "nano" : nullptr));
#ifdef WITH_RANDOMX
if (p->m_disableRandomX) {
if (m_params.m_disableRandomX) {
m_hasher = new RandomX_Hasher_RPC(this);
}
else {
@@ -252,7 +220,7 @@ p2pool::p2pool(int argc, char* argv[])
p2pool::~p2pool()
{
#ifdef WITH_UPNP
if (m_params->m_upnp) {
if (m_params.m_upnp) {
destroy_upnp();
}
#endif
@@ -295,7 +263,6 @@ p2pool::~p2pool()
delete m_hasher;
delete m_blockTemplate;
delete m_mempool;
delete m_params;
{
auto* p = bkg_jobs_tracker;
@@ -318,7 +285,7 @@ void p2pool::update_host_ping(const std::string& display_name, double ping)
LOGWARN(1, display_name << " ping is " << ping << " ms, this is too high for an efficient mining. Try to use a different node, or your own local node.");
}
const std::vector<Params::Host>& v = m_params->m_hosts;
const std::vector<Params::Host>& v = m_params.m_hosts;
for (size_t i = 0, n = v.size(); i < n; ++i) {
if (v[i].m_displayName == display_name) {
@@ -332,8 +299,8 @@ void p2pool::print_hosts() const
{
const Params::Host& host = current_host();
for (size_t i = 0, n = m_params->m_hosts.size(); i < n; ++i) {
const Params::Host& h = m_params->m_hosts[i];
for (size_t i = 0, n = m_params.m_hosts.size(); i < n; ++i) {
const Params::Host& h = m_params.m_hosts[i];
char buf[64] = {};
if (m_hostPing[i] > 0.0) {
@@ -417,7 +384,7 @@ void p2pool::handle_tx(TxMempoolData& tx)
}
#if TEST_MEMPOOL_PICKING_ALGORITHM
m_blockTemplate->update(miner_data(), *m_mempool, &m_params->m_wallet);
m_blockTemplate->update(miner_data(), *m_mempool, &m_params.m_wallet);
#endif
m_zmqLastActive = seconds_since_epoch();
@@ -557,7 +524,7 @@ void p2pool::get_missing_heights()
const Params::Host& host = current_host();
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params.m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
[this, h](const char* data, size_t size, double)
{
ChainMain block;
@@ -801,14 +768,14 @@ void p2pool::update_aux_data(const hash& chain_id)
void p2pool::send_aux_job_donation()
{
#ifdef WITH_TLS
if (m_params->m_authorKeyFile.empty()) {
if (m_params.m_authorKeyFile.empty()) {
return;
}
std::ifstream f(m_params->m_authorKeyFile, std::ios::binary | std::ios::ate);
std::ifstream f(m_params.m_authorKeyFile, std::ios::binary | std::ios::ate);
if (!f.good()) {
LOGERR(1, "send_aux_job_donation: failed to open " << m_params->m_authorKeyFile);
LOGERR(1, "send_aux_job_donation: failed to open " << m_params.m_authorKeyFile);
return;
}
@@ -816,7 +783,7 @@ void p2pool::send_aux_job_donation()
ON_SCOPE_LEAVE([&key](){ secure_zero_memory(key); });
if (f.tellg() != static_cast<std::streampos>(sizeof(key))) {
LOGERR(1, "send_aux_job_donation: " << m_params->m_authorKeyFile << " has an invalid size");
LOGERR(1, "send_aux_job_donation: " << m_params.m_authorKeyFile << " has an invalid size");
return;
}
@@ -824,21 +791,21 @@ void p2pool::send_aux_job_donation()
f.read(reinterpret_cast<char*>(&key), sizeof(key));
if (!f.good()) {
LOGERR(1, "send_aux_job_donation: failed to read data from " << m_params->m_authorKeyFile);
LOGERR(1, "send_aux_job_donation: failed to read data from " << m_params.m_authorKeyFile);
return;
}
const uint64_t timestamp = time(nullptr);
if (timestamp >= read_unaligned(reinterpret_cast<uint64_t*>(key.expiration_time))) {
LOGERR(1, "send_aux_job_donation: " << m_params->m_authorKeyFile << " is expired");
LOGERR(1, "send_aux_job_donation: " << m_params.m_authorKeyFile << " is expired");
return;
}
const uint8_t* p = reinterpret_cast<uint8_t*>(&key);
if (!ED25519_verify(p, sizeof(key.pub_key) + sizeof(key.expiration_time), key.master_key_signature, ED25519_MASTER_PUBLIC_KEY)) {
LOGERR(1, "send_aux_job_donation: " << m_params->m_authorKeyFile << ": signature verification failed");
LOGERR(1, "send_aux_job_donation: " << m_params.m_authorKeyFile << ": signature verification failed");
return;
}
@@ -1162,7 +1129,7 @@ void p2pool::submit_block() const
const uint64_t t1 = microseconds_since_epoch();
JSONRPCRequest::call(host.m_address, host.m_rpcPort, request, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
JSONRPCRequest::call(host.m_address, host.m_rpcPort, request, host.m_rpcLogin, m_params.m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
[height, diff, template_id, nonce, extra_nonce, merge_mining_root, is_external](const char* data, size_t size, double)
{
rapidjson::Document doc;
@@ -1281,7 +1248,7 @@ void p2pool::download_block_headers1(uint64_t current_height)
s.m_pos = 0;
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_header_by_height\",\"params\":{\"height\":" << prev_seed_height << "}}" << '\0';
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params.m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
[this, prev_seed_height, current_height](const char* data, size_t size, double) {
ChainMain block;
if (parse_block_header(data, size, block)) {
@@ -1314,7 +1281,7 @@ void p2pool::download_block_headers2(uint64_t current_height)
s.m_pos = 0;
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_header_by_height\",\"params\":{\"height\":" << seed_height << "}}" << '\0';
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params.m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
[this, seed_height, current_height](const char* data, size_t size, double) {
ChainMain block;
if (parse_block_header(data, size, block)) {
@@ -1350,7 +1317,7 @@ void p2pool::download_block_headers3(uint64_t start_height, uint64_t current_hei
s.m_pos = 0;
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_headers_range\",\"params\":{\"start_height\":" << start_height << ",\"end_height\":" << next_height << "}}" << '\0';
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params.m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
[this, start_height, next_height, current_height](const char* data, size_t size, double) {
if (parse_block_headers_range(data, size) == next_height - start_height + 1) {
download_block_headers3(next_height + 1, current_height);
@@ -1383,7 +1350,7 @@ void p2pool::download_block_headers4(uint64_t start_height, uint64_t current_hei
s.m_pos = 0;
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_block_headers_range\",\"params\":{\"start_height\":" << start_height << ",\"end_height\":" << current_height - 1 << "}}" << '\0';
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
JSONRPCRequest::call(host.m_address, host.m_rpcPort, buf, host.m_rpcLogin, m_params.m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
[this, start_height, current_height, host](const char* data, size_t size, double)
{
if (parse_block_headers_range(data, size) == current_height - start_height) {
@@ -1392,14 +1359,14 @@ void p2pool::download_block_headers4(uint64_t start_height, uint64_t current_hei
m_p2pServer = new P2PServer(this);
m_stratumServer = new StratumServer(this);
#if defined(WITH_RANDOMX) && !defined(P2POOL_UNIT_TESTS)
if (m_params->m_minerThreads) {
start_mining(m_params->m_minerThreads);
if (m_params.m_minerThreads) {
start_mining(m_params.m_minerThreads);
}
{
WriteLock lock(m_ZMQReaderLock);
try {
m_ZMQReader = new ZMQReader(host.m_address, host.m_zmqPort, m_params->m_socks5Proxy, this);
m_ZMQReader = new ZMQReader(host.m_address, host.m_zmqPort, m_params.m_socks5Proxy, this);
m_zmqLastActive = seconds_since_epoch();
}
catch (const std::exception& e) {
@@ -1413,10 +1380,10 @@ void p2pool::download_block_headers4(uint64_t start_height, uint64_t current_hei
get_miner_data();
// Get ping times for all other hosts
for (const Params::Host& h : m_params->m_hosts) {
for (const Params::Host& h : m_params.m_hosts) {
const std::string& name = h.m_displayName;
if (name != host.m_displayName) {
JSONRPCRequest::call(h.m_address, h.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_version\"}", h.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
JSONRPCRequest::call(h.m_address, h.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_version\"}", h.m_rpcLogin, m_params.m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
[this, name](const char*, size_t, double tcp_ping) { update_host_ping(name, tcp_ping); },
[](const char*, size_t, double) {});
}
@@ -1424,7 +1391,7 @@ void p2pool::download_block_headers4(uint64_t start_height, uint64_t current_hei
std::vector<IMergeMiningClient*> merge_mining_clients;
for (const auto& h : m_params->m_mergeMiningHosts) {
for (const auto& h : m_params.m_mergeMiningHosts) {
IMergeMiningClient* c = IMergeMiningClient::create(this, h.m_host, h.m_wallet);
if (c) {
merge_mining_clients.push_back(c);
@@ -1525,7 +1492,7 @@ void p2pool::get_info()
{
const Params::Host& host = current_host();
JSONRPCRequest::call(host.m_address, host.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_info\"}", host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
JSONRPCRequest::call(host.m_address, host.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_info\"}", host.m_rpcLogin, m_params.m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
[this](const char* data, size_t size, double)
{
parse_get_info_rpc(data, size);
@@ -1549,7 +1516,7 @@ void p2pool::load_found_blocks()
return;
}
std::ifstream f(DATA_DIR + FOUND_BLOCKS_FILE);
std::ifstream f(m_params.m_dataDir + FOUND_BLOCKS_FILE);
if (!f.is_open()) {
return;
}
@@ -1644,7 +1611,7 @@ void p2pool::get_version()
{
const Params::Host& host = current_host();
JSONRPCRequest::call(host.m_address, host.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_version\"}", host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
JSONRPCRequest::call(host.m_address, host.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_version\"}", host.m_rpcLogin, m_params.m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
[this](const char* data, size_t size, double)
{
parse_get_version_rpc(data, size);
@@ -1721,7 +1688,7 @@ void p2pool::get_miner_data(bool retry)
const Params::Host& host = current_host();
JSONRPCRequest::call(host.m_address, host.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_miner_data\"}", host.m_rpcLogin, m_params->m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
JSONRPCRequest::call(host.m_address, host.m_rpcPort, "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"get_miner_data\"}", host.m_rpcLogin, m_params.m_socks5Proxy, host.m_rpcSSL, host.m_rpcSSL_Fingerprint,
[this, host](const char* data, size_t size, double tcp_ping)
{
parse_get_miner_data_rpc(data, size);
@@ -2085,7 +2052,7 @@ void p2pool::api_update_block_found(const ChainMain* data, const PoolBlock* bloc
difficulty_type diff;
if (data && get_difficulty_at_height(data->height, diff)) {
const std::string path = DATA_DIR + FOUND_BLOCKS_FILE;
const std::string path = m_params.m_dataDir + FOUND_BLOCKS_FILE;
std::ofstream f(path, std::ios::app);
if (f.is_open()) {
f << cur_time << ' ' << data->height << ' ' << data->id << ' ' << diff << ' ' << total_hashes << '\n';
@@ -2141,7 +2108,7 @@ void p2pool::on_external_block(const PoolBlock& block)
void p2pool::api_update_aux_data()
{
if (!m_api || !m_params->m_localStats || m_stopped) {
if (!m_api || !m_params.m_localStats || m_stopped) {
return;
}
@@ -2291,7 +2258,7 @@ bool p2pool::zmq_running() const
const Params::Host& p2pool::switch_host()
{
const std::vector<Params::Host>& v = m_params->m_hosts;
const std::vector<Params::Host>& v = m_params.m_hosts;
return v[++m_currentHostIndex % v.size()];
}
@@ -2316,7 +2283,7 @@ void p2pool::reconnect_to_host()
m_ZMQReader = nullptr;
try {
ZMQReader* new_reader = new ZMQReader(new_host.m_address, new_host.m_zmqPort, m_params->m_socks5Proxy, this);
ZMQReader* new_reader = new ZMQReader(new_host.m_address, new_host.m_zmqPort, m_params.m_socks5Proxy, this);
m_zmqLastActive = seconds_since_epoch();
m_ZMQReader = new_reader;
}
@@ -2332,7 +2299,7 @@ void p2pool::reconnect_to_host()
int p2pool::run()
{
if (!m_params->valid()) {
if (!m_params.valid()) {
LOGERR(1, "Invalid or missing command line. Try \"p2pool --help\".");
return 1;
}
@@ -2343,8 +2310,8 @@ int p2pool::run()
}
#ifdef WITH_TLS
if (!m_params->m_tlsCert.empty() && !m_params->m_tlsCertKey.empty()) {
if (!ServerTls::load_from_files(m_params->m_tlsCert.c_str(), m_params->m_tlsCertKey.c_str())) {
if (!m_params.m_tlsCert.empty() && !m_params.m_tlsCertKey.empty()) {
if (!ServerTls::load_from_files(m_params.m_tlsCert.c_str(), m_params.m_tlsCertKey.c_str())) {
LOGERR(1, "Failed to load TLS files");
return 1;
}
+5 -5
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@ struct PoolBlock;
class p2pool : public MinerCallbackHandler, public nocopy_nomove
{
public:
p2pool(int argc, char* argv[]);
explicit p2pool(const Params& params);
~p2pool() override;
int run();
@@ -48,13 +48,13 @@ public:
bool stopped() const { return m_stopped; }
void stop();
const Params& params() const { return *m_params; }
const Params& params() const { return m_params; }
BlockTemplate& block_template() { return *m_blockTemplate; }
SideChain& side_chain() { return *m_sideChain; }
FORCEINLINE const Params::Host& current_host() const
{
const std::vector<Params::Host>& v = m_params->m_hosts;
const std::vector<Params::Host>& v = m_params.m_hosts;
return v[m_currentHostIndex % v.size()];
}
@@ -158,7 +158,7 @@ private:
std::atomic<bool> m_stopped;
const Params* m_params;
const Params& m_params;
std::vector<double> m_hostPing;
std::atomic<uint32_t> m_currentHostIndex;
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+435 -262
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,6 +19,13 @@
#include "params.h"
#include "stratum_server.h"
#include "p2p_server.h"
#include "i2p.h"
#include <fstream>
#ifdef WITH_GRPC
#include "merge_mining_client.h"
#include "merge_mining_client_tari.h"
#endif
LOG_CATEGORY(Params)
@@ -29,270 +36,16 @@ namespace p2pool {
static constexpr uint64_t MIN_STRATUM_BAN_TIME = UINT64_C(1);
static constexpr uint64_t MAX_STRATUM_BAN_TIME = (UINT64_C(1) << 34) - 1;
Params::Params(int argc, char* const argv[])
Params::Params(const std::vector<std::vector<std::string>>& args)
{
for (int i = 1; i < argc; ++i) {
bool ok = false;
if ((strcmp(argv[i], "--host") == 0) && (i + 1 < argc)) {
const char* address = argv[++i];
if (m_hosts.empty()) {
m_hosts.emplace_back();
m_hosts.back().m_address = address;
}
else {
const Host& h = m_hosts.back();
m_hosts.emplace_back(address, h.m_rpcPort, h.m_zmqPort, "");
}
ok = true;
for (const auto& arg : args) {
// Ignore empty parameters
if (arg.empty() || arg[0].empty()) {
continue;
}
if ((strcmp(argv[i], "--rpc-port") == 0) && (i + 1 < argc)) {
if (m_hosts.empty()) {
m_hosts.emplace_back();
}
m_hosts.back().m_rpcPort = static_cast<int32_t>(std::min(std::max(strtoul(argv[++i], nullptr, 10), 1UL), 65535UL));
ok = true;
}
if ((strcmp(argv[i], "--zmq-port") == 0) && (i + 1 < argc)) {
if (m_hosts.empty()) {
m_hosts.emplace_back();
}
m_hosts.back().m_zmqPort = static_cast<int32_t>(std::min(std::max(strtoul(argv[++i], nullptr, 10), 1UL), 65535UL));
ok = true;
}
if (strcmp(argv[i], "--light-mode") == 0) {
m_lightMode = true;
ok = true;
}
if ((strcmp(argv[i], "--wallet") == 0) && (i + 1 < argc)) {
const char* s = argv[++i];
if (!m_mainWallet.decode(s)) {
LOGERR(1, "Wallet " << s << " failed to decode");
}
ok = true;
}
if ((strcmp(argv[i], "--subaddress") == 0) && (i + 1 < argc)) {
const char* s = argv[++i];
if (!m_subaddress.decode(s)) {
LOGERR(1, "Subaddress " << s << " failed to decode");
}
ok = true;
}
if ((strcmp(argv[i], "--stratum") == 0) && (i + 1 < argc)) {
m_stratumAddresses = argv[++i];
ok = true;
}
if ((strcmp(argv[i], "--stratum-ban-time") == 0) && (i + 1 < argc)) {
m_stratumBanTime = strtoull(argv[++i], nullptr, 10);
ok = true;
}
if ((strcmp(argv[i], "--p2p") == 0) && (i + 1 < argc)) {
m_p2pAddresses = argv[++i];
ok = true;
}
if ((strcmp(argv[i], "--addpeers") == 0) && (i + 1 < argc)) {
m_p2pPeerList = argv[++i];
ok = true;
}
if ((strcmp(argv[i], "--loglevel") == 0) && (i + 1 < argc)) {
const int level = std::min(std::max<int>(static_cast<int>(strtol(argv[++i], nullptr, 10)), 0), log::MAX_GLOBAL_LOG_LEVEL);
log::GLOBAL_LOG_LEVEL = level;
ok = true;
}
if ((strcmp(argv[i], "--data-dir") == 0) && (i + 1 < argc)) {
// Processed in main.cpp
++i;
ok = true;
}
if ((strcmp(argv[i], "--sidechain-config") == 0) && (i + 1 < argc)) {
m_sidechainConfig = argv[++i];
ok = true;
}
if ((strcmp(argv[i], "--data-api") == 0) && (i + 1 < argc)) {
m_apiPath = argv[++i];
ok = true;
}
if ((strcmp(argv[i], "--local-api") == 0) || (strcmp(argv[i], "--stratum-api") == 0)) {
m_localStats = true;
ok = true;
}
if (strcmp(argv[i], "--no-cache") == 0) {
m_blockCache = false;
ok = true;
}
if (strcmp(argv[i], "--no-color") == 0) {
log::CONSOLE_COLORS = false;
ok = true;
}
#ifdef WITH_RANDOMX
if (strcmp(argv[i], "--no-randomx") == 0) {
m_disableRandomX = true;
ok = true;
}
#endif
if ((!strcmp(argv[i], "--out-peers") || !strcmp(argv[i], "--outpeers")) && (i + 1 < argc)) {
m_maxOutgoingPeers = std::min(std::max(strtoul(argv[++i], nullptr, 10), 10UL), 450UL);
ok = true;
}
if ((!strcmp(argv[i], "--in-peers") || !strcmp(argv[i], "--inpeers")) && (i + 1 < argc)) {
m_maxIncomingPeers = std::min(std::max(strtoul(argv[++i], nullptr, 10), 10UL), 450UL);
ok = true;
}
if ((strcmp(argv[i], "--start-mining") == 0) && (i + 1 < argc)) {
m_minerThreads = std::min(std::max(strtoul(argv[++i], nullptr, 10), 1UL), 64UL);
ok = true;
}
if (strcmp(argv[i], "--mini") == 0) {
m_mini = true;
ok = true;
}
if (strcmp(argv[i], "--nano") == 0) {
m_nano = true;
ok = true;
}
if (strcmp(argv[i], "--no-autodiff") == 0) {
m_autoDiff = false;
ok = true;
}
if ((strcmp(argv[i], "--rpc-login") == 0) && (i + 1 < argc)) {
if (m_hosts.empty()) {
m_hosts.emplace_back();
}
m_hosts.back().m_rpcLogin = argv[++i];
ok = true;
}
#ifdef WITH_TLS
if (strcmp(argv[i], "--rpc-ssl") == 0) {
if (m_hosts.empty()) {
m_hosts.emplace_back();
}
m_hosts.back().m_rpcSSL = true;
ok = true;
}
if ((strcmp(argv[i], "--rpc-ssl-fingerprint") == 0) && (i + 1 < argc)) {
if (m_hosts.empty()) {
m_hosts.emplace_back();
}
m_hosts.back().m_rpcSSL_Fingerprint = argv[++i];
ok = true;
}
#endif
if ((strcmp(argv[i], "--socks5") == 0) && (i + 1 < argc)) {
m_socks5Proxy = argv[++i];
ok = true;
}
if (strcmp(argv[i], "--no-dns") == 0) {
m_dns = false;
disable_resolve_host = true;
ok = true;
}
if ((strcmp(argv[i], "--p2p-external-port") == 0) && (i + 1 < argc)) {
m_p2pExternalPort = static_cast<int32_t>(std::min(std::max(strtoul(argv[++i], nullptr, 10), 1UL), 65535UL));
ok = true;
}
#ifdef WITH_UPNP
if ((strcmp(argv[i], "--no-upnp") == 0) || (strcmp(argv[i], "--no-igd") == 0)) {
m_upnp = false;
ok = true;
}
if (strcmp(argv[i], "--upnp-stratum") == 0) {
m_upnpStratum = true;
ok = true;
}
#endif
if ((strcmp(argv[i], "--merge-mine") == 0) && (i + 2 < argc)) {
m_mergeMiningHosts.emplace_back(argv[i + 1], argv[i + 2]);
i += 2;
ok = true;
}
#ifdef WITH_TLS
if ((strcmp(argv[i], "--tls-cert") == 0) && (i + 1 < argc)) {
m_tlsCert = argv[++i];
ok = true;
}
if ((strcmp(argv[i], "--tls-cert-key") == 0) && (i + 1 < argc)) {
m_tlsCertKey = argv[++i];
ok = true;
}
#endif
if (strcmp(argv[i], "--no-stratum-http") == 0) {
m_enableStratumHTTP = false;
ok = true;
}
#ifdef WITH_MERGE_MINING_DONATION
if ((strcmp(argv[i], "--adkf") == 0) && (i + 1 < argc)) {
m_authorKeyFile = argv[++i];
ok = true;
}
#endif
if (strcmp(argv[i], "--full-validation") == 0) {
m_enableFullValidation = true;
ok = true;
}
if ((strcmp(argv[i], "--onion-address") == 0) && (i + 1 < argc)) {
m_onionAddress = argv[++i];
ok = true;
}
if (strcmp(argv[i], "--no-clearnet-p2p") == 0) {
m_noClearnetP2P = true;
ok = true;
}
if (!ok) {
// Wait to avoid log messages overlapping with printf() calls and making a mess on screen
std::this_thread::sleep_for(std::chrono::milliseconds(10));
fprintf(stderr, "Unknown command line parameter %s\n\n", argv[i]);
if (!process_arg(arg)) {
fprintf(stderr, "Unknown or invalid command line parameter \"%s\"\n\n", arg[0].c_str());
p2pool_usage();
throw std::exception();
}
@@ -307,6 +60,15 @@ Params::Params(int argc, char* const argv[])
}
}
if (!m_i2pAddress.empty()) {
m_i2pDestinationHash = from_i2p_b32(m_i2pAddress);
if (m_i2pDestinationHash.empty()) {
LOGERR(1, "Failed to parse \"" << m_i2pAddress << '"');
throw std::exception();
}
}
auto invalid_host = [](const Host& h)
{
if (!h.valid()) {
@@ -322,6 +84,23 @@ Params::Params(int argc, char* const argv[])
m_hosts.emplace_back();
}
const int p2p_port = m_mini ? DEFAULT_P2P_PORT_MINI : (m_nano ? DEFAULT_P2P_PORT_NANO : DEFAULT_P2P_PORT);
if (m_noClearnetP2P) {
char buf[48] = {};
log::Stream s(buf);
s << "127.0.0.1:" << p2p_port;
m_p2pAddresses = buf;
}
else if (m_p2pAddresses.empty()) {
char buf[48] = {};
log::Stream s(buf);
s << "[::]:" << p2p_port << ",0.0.0.0:" << p2p_port;
m_p2pAddresses = buf;
}
if (m_stratumAddresses.empty()) {
const int stratum_port = DEFAULT_STRATUM_PORT;
@@ -358,6 +137,381 @@ Params::Params(int argc, char* const argv[])
}
m_displayWallet.assign(display_wallet_buf, Wallet::ADDRESS_LENGTH);
for (Params::Host& h : m_hosts) {
if (!h.init_display_name(*this)) {
throw std::exception();
}
}
// If the data directory is not set, check if P2Pool has write access to the current directory
// If it doesn't, switch to user's home directory
if (m_dataDir.empty()) {
std::ofstream f("p2pool.tmp");
if (f && f.put(' ')) {
f.close();
std::remove("p2pool.tmp");
}
else {
char buf[1024];
size_t size = sizeof(buf);
if (uv_os_homedir(buf, &size) == 0) {
m_dataDir.assign(buf, size);
fixup_path(m_dataDir);
m_dataDir += ".p2pool/";
if (m_mini) {
m_dataDir += "mini/";
}
else if (m_nano) {
m_dataDir += "nano/";
}
}
}
}
else {
fixup_path(m_dataDir);
}
// Detect the proxy type
if (!m_socks5Proxy.empty() && (m_socks5ProxyType == ProxyType::AUTO)) {
m_socks5ProxyType = ProxyType::INVALID;
const size_t k = m_socks5Proxy.find_last_of(':');
if ((k != std::string::npos) && (k < m_socks5Proxy.length() - 1)) {
const unsigned long port = strtoul(m_socks5Proxy.substr(k + 1).c_str(), nullptr, 10);
if ((port > 0) && (port < 65536)) {
switch (port) {
case 9050:
m_socks5ProxyType = ProxyType::TOR;
break;
case 4447:
m_socks5ProxyType = ProxyType::I2P;
break;
default:
m_socks5ProxyType = ProxyType::PLAIN;
break;
}
}
}
}
}
bool Params::process_arg(const std::vector<std::string>& arg)
{
if ((arg[0] == "host") && has1(arg)) {
const std::string& address = arg[1];
if (m_hosts.empty()) {
m_hosts.emplace_back();
m_hosts.back().m_address = address;
}
else {
const Host& h = m_hosts.back();
int32_t rpc_port = h.m_rpcPort;
int32_t zmq_port = h.m_zmqPort;
// Better not to use "h" here because emplace_back can reallocate
m_hosts.emplace_back(address, rpc_port, zmq_port, std::string());
}
return true;
}
if ((arg[0] == "rpc-port") && has1(arg)) {
if (m_hosts.empty()) {
m_hosts.emplace_back();
}
m_hosts.back().m_rpcPort = static_cast<int32_t>(std::min(std::max(strtoul(arg[1].c_str(), nullptr, 10), 1UL), 65535UL));
return true;
}
if ((arg[0] == "zmq-port") && has1(arg)) {
if (m_hosts.empty()) {
m_hosts.emplace_back();
}
m_hosts.back().m_zmqPort = static_cast<int32_t>(std::min(std::max(strtoul(arg[1].c_str(), nullptr, 10), 1UL), 65535UL));
return true;
}
if (arg[0] == "light-mode") {
m_lightMode = true;
return true;
}
if ((arg[0] == "wallet") && has1(arg)) {
const char* s = arg[1].c_str();
if (!m_mainWallet.decode(s)) {
LOGERR(1, "Wallet " << s << " failed to decode");
}
return true;
}
if ((arg[0] == "subaddress") && has1(arg)) {
const char* s = arg[1].c_str();
if (!m_subaddress.decode(s)) {
LOGERR(1, "Subaddress " << s << " failed to decode");
}
return true;
}
if ((arg[0] == "stratum") && has1(arg)) {
m_stratumAddresses = arg[1];
return true;
}
if ((arg[0] == "stratum-ban-time") && has1(arg)) {
m_stratumBanTime = strtoull(arg[1].c_str(), nullptr, 10);
return true;
}
if ((arg[0] == "p2p") && has1(arg)) {
m_p2pAddresses = arg[1];
return true;
}
if ((arg[0] == "addpeers") && has1(arg)) {
m_p2pPeerList = arg[1];
return true;
}
if ((arg[0] == "loglevel") && has1(arg)) {
const int level = std::min(std::max<int>(static_cast<int>(strtol(arg[1].c_str(), nullptr, 10)), 0), log::MAX_GLOBAL_LOG_LEVEL);
log::GLOBAL_LOG_LEVEL = level;
return true;
}
if ((arg[0] == "data-dir") && has1(arg)) {
m_dataDir = arg[1];
return true;
}
if ((arg[0] == "log-file") && has1(arg)) {
m_logFilePath = arg[1];
return true;
}
if ((arg[0] == "no-console-log")) {
m_consoleLogEnabled = false;
return true;
}
if ((arg[0] == "no-log-file")) {
m_logFileEnabled = false;
return true;
}
if ((arg[0] == "disable-log")) {
m_consoleLogEnabled = false;
m_logFileEnabled = false;
return true;
}
if ((arg[0] == "sidechain-config") && has1(arg)) {
m_sidechainConfig = arg[1];
return true;
}
if ((arg[0] == "data-api") && has1(arg)) {
m_apiPath = arg[1];
return true;
}
if ((arg[0] == "local-api") || (arg[0] == "stratum-api")) {
m_localStats = true;
return true;
}
if (arg[0] == "no-cache") {
m_blockCache = false;
return true;
}
if (arg[0] == "no-color") {
log::CONSOLE_COLORS = false;
return true;
}
#ifdef WITH_RANDOMX
if (arg[0] == "no-randomx") {
m_disableRandomX = true;
return true;
}
#endif
if (((arg[0] == "out-peers") || (arg[0] == "outpeers")) && has1(arg)) {
m_maxOutgoingPeers = std::min(std::max(strtoul(arg[1].c_str(), nullptr, 10), 10UL), 450UL);
return true;
}
if (((arg[0] == "in-peers") || (arg[0] == "inpeers")) && has1(arg)) {
m_maxIncomingPeers = std::min(std::max(strtoul(arg[1].c_str(), nullptr, 10), 10UL), 450UL);
return true;
}
if ((arg[0] == "start-mining") && has1(arg)) {
m_minerThreads = std::min(std::max(strtoul(arg[1].c_str(), nullptr, 10), 1UL), 64UL);
return true;
}
if (arg[0] == "mini") {
m_mini = true;
return true;
}
if (arg[0] == "nano") {
m_nano = true;
return true;
}
if (arg[0] == "no-autodiff") {
m_autoDiff = false;
return true;
}
if ((arg[0] == "rpc-login") && has1(arg)) {
if (m_hosts.empty()) {
m_hosts.emplace_back();
}
m_hosts.back().m_rpcLogin = arg[1];
return true;
}
#ifdef WITH_TLS
if (arg[0] == "rpc-ssl") {
if (m_hosts.empty()) {
m_hosts.emplace_back();
}
m_hosts.back().m_rpcSSL = true;
return true;
}
if ((arg[0] == "rpc-ssl-fingerprint") && has1(arg)) {
if (m_hosts.empty()) {
m_hosts.emplace_back();
}
m_hosts.back().m_rpcSSL_Fingerprint = arg[1];
return true;
}
#endif
if ((arg[0] == "socks5") && has1(arg)) {
m_socks5Proxy = arg[1];
return true;
}
if ((arg[0] == "socks5-proxy-type") && has1(arg)) {
const std::string s = tolower(arg[1]);
m_socks5ProxyType = ProxyType::INVALID;
if (s == "auto") m_socks5ProxyType = ProxyType::AUTO;
if (s == "plain") m_socks5ProxyType = ProxyType::PLAIN;
if (s == "tor") m_socks5ProxyType = ProxyType::TOR;
if (s == "i2p") m_socks5ProxyType = ProxyType::I2P;
return m_socks5ProxyType != ProxyType::INVALID;
}
if (arg[0] == "no-dns") {
m_dns = false;
disable_resolve_host = true;
return true;
}
if ((arg[0] == "p2p-external-port") && has1(arg)) {
m_p2pExternalPort = static_cast<int32_t>(std::min(std::max(strtoul(arg[1].c_str(), nullptr, 10), 1UL), 65535UL));
return true;
}
#ifdef WITH_UPNP
if ((arg[0] == "no-upnp") || (arg[0] == "no-igd")) {
m_upnp = false;
return true;
}
if (arg[0] == "upnp-stratum") {
m_upnpStratum = true;
return true;
}
#endif
if ((arg[0] == "merge-mine") && has1(arg) && has2(arg)) {
m_mergeMiningHosts.emplace_back(arg[1], arg[2]);
return true;
}
#ifdef WITH_TLS
if ((arg[0] == "tls-cert") && has1(arg)) {
m_tlsCert = arg[1];
return true;
}
if ((arg[0] == "tls-cert-key") && has1(arg)) {
m_tlsCertKey = arg[1];
return true;
}
#endif
if (arg[0] == "no-stratum-http") {
m_enableStratumHTTP = false;
return true;
}
#ifdef WITH_MERGE_MINING_DONATION
if ((arg[0] == "adkf") && has1(arg)) {
m_authorKeyFile = arg[1];
return true;
}
#endif
if (arg[0] == "full-validation") {
m_enableFullValidation = true;
return true;
}
if ((arg[0] == "onion-address") && has1(arg)) {
m_onionAddress = arg[1];
return true;
}
if ((arg[0] == "i2p-address") && has1(arg)) {
m_i2pAddress = arg[1];
return true;
}
if (arg[0] == "no-clearnet-p2p") {
m_noClearnetP2P = true;
return true;
}
if (arg[0] == "stratum-proxy-protocol") {
m_stratumProxyProtocol = true;
return true;
}
if (arg[0] == "p2p-proxy-protocol") {
m_p2pProxyProtocol = true;
return true;
}
return false;
}
bool Params::valid() const
@@ -410,9 +564,28 @@ bool Params::valid() const
return false;
}
if (m_socks5ProxyType == ProxyType::INVALID) {
LOGERR(1, "Invalid SOCKS5 proxy type. Check the --socks5 and --socks5-proxy-type parameters.");
return false;
}
return true;
}
#ifdef WITH_GRPC
bool Params::grpc_needed() const
{
for (const MergeMiningHost& h : m_mergeMiningHosts) {
if (h.m_host.find(MergeMiningClientTari::TARI_PREFIX) == 0) {
return true;
}
}
return false;
}
#endif
bool Params::Host::init_display_name(const Params& p)
{
m_displayName = m_address;
+41 -7
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,15 +29,19 @@ struct Params
FORCEINLINE Params() {}
#endif
Params(int argc, char* const argv[]);
explicit Params(const std::vector<std::vector<std::string>>& args);
bool valid() const;
[[nodiscard]] bool valid() const;
#ifdef WITH_GRPC
[[nodiscard]] bool grpc_needed() const;
#endif
struct Host
{
Host() : m_address("127.0.0.1"), m_rpcPort(18081), m_zmqPort(18083), m_rpcSSL(false) {}
Host(const char* address, int32_t rpcPort, int32_t zmqPort, const char* rpcLogin)
Host(const std::string& address, int32_t rpcPort, int32_t zmqPort, const std::string& rpcLogin)
: m_address(address)
, m_rpcPort(rpcPort)
, m_zmqPort(zmqPort)
@@ -45,9 +49,9 @@ struct Params
, m_rpcSSL(false)
{}
bool valid() const { return !m_address.empty() && m_rpcPort && m_zmqPort && (m_rpcPort != m_zmqPort); }
[[nodiscard]] bool valid() const { return !m_address.empty() && m_rpcPort && m_zmqPort && (m_rpcPort != m_zmqPort); }
bool init_display_name(const Params& p);
[[nodiscard]] bool init_display_name(const Params& p);
std::string m_address;
int32_t m_rpcPort;
@@ -65,7 +69,8 @@ struct Params
struct MergeMiningHost
{
MergeMiningHost(const char* host, const char* wallet) : m_host(host), m_wallet(wallet) {}
template<typename T>
FORCEINLINE MergeMiningHost(const T& host, const T& wallet) : m_host(host), m_wallet(wallet) {}
std::string m_host;
std::string m_wallet;
@@ -85,6 +90,10 @@ struct Params
std::string m_stratumAddresses;
std::string m_p2pAddresses;
std::string m_p2pPeerList;
std::string m_dataDir;
std::string m_logFilePath;
bool m_consoleLogEnabled = true;
bool m_logFileEnabled = true;
std::string m_sidechainConfig;
std::string m_apiPath;
uint64_t m_stratumBanTime = DEFAULT_STRATUM_BAN_TIME;
@@ -101,7 +110,18 @@ struct Params
bool m_mini = false;
bool m_nano = false;
bool m_autoDiff = true;
std::string m_socks5Proxy;
enum ProxyType {
INVALID = -1,
AUTO = 0,
PLAIN = 1,
TOR = 2,
I2P = 3,
MAX = 4,
} m_socks5ProxyType = ProxyType::AUTO;
bool m_dns = true;
int32_t m_p2pExternalPort = 0;
#ifdef WITH_UPNP
@@ -131,7 +151,21 @@ struct Params
std::string m_onionAddress;
hash m_onionPubkey;
// Hidden service address provided by the user
std::string m_i2pAddress;
// Raw hash of the destination info; decoded Base32 address with suffix removed
hash m_i2pDestinationHash;
bool m_noClearnetP2P = false;
bool m_stratumProxyProtocol = false;
bool m_p2pProxyProtocol = false;
private:
[[nodiscard]] bool process_arg(const std::vector<std::string>& arg);
[[nodiscard]] static bool has1(const std::vector<std::string>& arg) { return (arg.size() > 1) && !arg[1].empty();}
[[nodiscard]] static bool has2(const std::vector<std::string>& arg) { return (arg.size() > 2) && !arg[2].empty();}
};
} // namespace p2pool
+12 -4
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -51,7 +51,6 @@ PoolBlock::PoolBlock()
, m_difficulty{}
, m_cumulativeDifficulty{}
, m_merkleProof{}
, m_merkleProofPath(0)
, m_mergeMiningExtra{}
, m_sidechainExtraBuf{}
, m_sidechainId{}
@@ -108,7 +107,6 @@ PoolBlock& PoolBlock::operator=(const PoolBlock& b)
m_difficulty = b.m_difficulty;
m_cumulativeDifficulty = b.m_cumulativeDifficulty;
m_merkleProof = b.m_merkleProof;
m_merkleProofPath = b.m_merkleProofPath;
m_mergeMiningExtra = b.m_mergeMiningExtra;
memcpy(m_sidechainExtraBuf, b.m_sidechainExtraBuf, sizeof(m_sidechainExtraBuf));
m_sidechainId = b.m_sidechainId;
@@ -139,6 +137,11 @@ PoolBlock& PoolBlock::operator=(const PoolBlock& b)
std::vector<uint8_t> PoolBlock::serialize_mainchain_data(size_t* header_size, size_t* miner_tx_size, int* outputs_offset, int* outputs_blob_size, const uint32_t* nonce, const uint32_t* extra_nonce) const
{
if (m_transactions.empty()) {
LOGERR(1, "Trying to serialize an uninitialized block, fix the code!");
return {};
}
std::vector<uint8_t> data;
data.reserve(std::min<size_t>(128 + m_outputAmounts.size() * 39 + m_transactions.size() * HASH_SIZE, 131072));
@@ -200,7 +203,7 @@ std::vector<uint8_t> PoolBlock::serialize_mainchain_data(size_t* header_size, si
}
*(p++) = TX_EXTRA_NONCE;
*(p++) = static_cast<uint8_t>(extra_nonce_size);
writeVarint(extra_nonce_size, [&p](uint8_t value) { *(p++) = value; });
if (!extra_nonce) {
extra_nonce = &m_extraNonce;
@@ -343,6 +346,11 @@ void PoolBlock::reset_offchain_data()
bool PoolBlock::get_pow_hash(RandomX_Hasher_Base* hasher, uint64_t height, const hash& seed_hash, hash& pow_hash, bool force_light_mode)
{
if (m_transactions.empty()) {
LOGERR(1, "Trying to calculate PoW hash of an uninitialized block, fix the code!");
return false;
}
// Calculate the coinbase tx hash, then the merkle root of all transactions in the block - this merkle root is what goes into the hashing blob
// Monero transactions are hashed in 3 separate parts, the resulting 3 hashes are then hashed together to get the final result
+4 -2
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -62,6 +62,9 @@ static constexpr difficulty_type MAX_CUMULATIVE_DIFFICULTY{ 13019633956666736640
// 1000 years at 1 block/second. It should be enough for any normal use.
static constexpr uint64_t MAX_SIDECHAIN_HEIGHT = 31556952000ULL;
// Taken from Monero's cryptonote_config.h
static constexpr uint64_t CRYPTONOTE_MAX_BLOCK_NUMBER = 500000000ULL;
// Limited by the format of the Merkle tree parameters in tx_extra
static constexpr uint64_t MERGE_MINING_MAX_CHAINS = 256;
static constexpr uint64_t LOG2_MERGE_MINING_MAX_CHAINS = 8;
@@ -140,7 +143,6 @@ struct PoolBlock
// Merkle proof for merge mining
std::vector<hash> m_merkleProof;
uint32_t m_merkleProofPath;
// Merge mining extra data
//
+29 -13
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -66,12 +66,11 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
READ_BYTE(m_minorVersion);
if (m_minorVersion < m_majorVersion) return __LINE__;
if (m_minorVersion > 127) return __LINE__;
READ_VARINT(m_timestamp);
READ_BUF(m_prevId.h, HASH_SIZE);
if (m_minorVersion > 127) return __LINE__;
const int nonce_offset = static_cast<int>(data - data_begin);
READ_BUF(&m_nonce, NONCE_SIZE);
@@ -79,11 +78,13 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
uint64_t unlock_height;
READ_VARINT(unlock_height);
if (unlock_height > CRYPTONOTE_MAX_BLOCK_NUMBER) return __LINE__;
EXPECT_BYTE(1);
EXPECT_BYTE(TXIN_GEN);
READ_VARINT(m_txinGenHeight);
if (m_txinGenHeight > CRYPTONOTE_MAX_BLOCK_NUMBER) return __LINE__;
if (m_majorVersion != sidechain.network_major_version(m_txinGenHeight)) return __LINE__;
if (unlock_height != m_txinGenHeight + MINER_REWARD_UNLOCK_TIME) return __LINE__;
@@ -98,9 +99,9 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
if (num_outputs > 0) {
// Outputs are in the buffer, just read them
// Each output is at least 34 bytes, exit early if there's not enough data left
// 1 byte for reward, 1 byte for tx_type, 32 bytes for eph_pub_key
constexpr uint64_t MIN_OUTPUT_SIZE = 34;
// Each output is at least 35 bytes, exit early if there's not enough data left
// 1 byte for reward, 1 byte for tx_type, 32 bytes for eph_pub_key, 1 byte for view_tag
constexpr uint64_t MIN_OUTPUT_SIZE = 35;
if (num_outputs > std::numeric_limits<uint64_t>::max() / MIN_OUTPUT_SIZE) return __LINE__;
if (static_cast<uint64_t>(data_end - data) < num_outputs * MIN_OUTPUT_SIZE) return __LINE__;
@@ -123,6 +124,8 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
}
t.m_reward = reward;
if (total_reward + reward < total_reward) return __LINE__;
total_reward += reward;
EXPECT_BYTE(TXOUT_TO_TAGGED_KEY);
@@ -158,6 +161,10 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
// Required by sidechain.get_outputs_blob() to speed up repeated broadcasts from different peers
READ_BUF(m_sidechainId.h, HASH_SIZE);
if (m_sidechainId.empty()) {
return __LINE__;
}
}
// Technically some p2pool node could keep stuffing block with transactions until reward is less than 0.6 XMR
@@ -269,6 +276,12 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
const int transactions_blob_size = static_cast<int>(num_transactions) * HASH_SIZE;
const int transactions_blob_size_diff = transactions_blob_size - transactions_actual_blob_size;
const int data_size = static_cast<int>((data_end - data_begin) + outputs_blob_size_diff + transactions_blob_size_diff);
if (data_size > static_cast<int>(MAX_BLOCK_SIZE)) {
return __LINE__;
}
#if POOL_BLOCK_DEBUG
m_mainChainDataDebug.reserve((data - data_begin) + outputs_blob_size_diff + transactions_blob_size_diff);
m_mainChainDataDebug.assign(data_begin, data_begin + outputs_offset);
@@ -370,6 +383,12 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
return __LINE__;
}
// m_cumulativeDifficulty is the sum of all m_difficulty values
// for this and preceding blocks, so this one must be impossible
if (m_difficulty > m_cumulativeDifficulty) {
return __LINE__;
}
m_merkleProof.clear();
m_mergeMiningExtra.clear();
@@ -413,9 +432,11 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
if (static_cast<uint64_t>(data_end - data) < n) return __LINE__;
std::vector<uint8_t> t;
t.resize(n);
READ_BUF(t.data(), n);
if (n > 0) {
t.resize(n);
READ_BUF(t.data(), n);
}
m_mergeMiningExtra.emplace(chain_id, std::move(t));
}
@@ -449,11 +470,6 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
hash check;
const std::vector<uint8_t>& consensus_id = sidechain.consensus_id();
const int data_size = static_cast<int>((data_end - data_begin) + outputs_blob_size_diff + transactions_blob_size_diff);
if (data_size > static_cast<int>(MAX_BLOCK_SIZE)) {
return __LINE__;
}
keccak_custom(
[nonce_offset, extra_nonce_offset, mm_root_hash_offset, data_begin, data_size, &consensus_id, &outputs_blob, outputs_blob_size_diff, outputs_offset, outputs_blob_size, transactions_blob, transactions_blob_size_diff, transactions_offset, transactions_blob_size](int offset) -> uint8_t
+3 -3
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -444,7 +444,7 @@ void RandomX_Hasher_RPC::loop(void* data)
LOGINFO(1, "event loop stopped");
}
bool RandomX_Hasher_RPC::calculate(const void* data_ptr, size_t size, uint64_t height, const hash& /*seed*/, hash& h, bool /*force_light_mode*/)
bool RandomX_Hasher_RPC::calculate(const void* data_ptr, size_t size, uint64_t height, const hash& seed, hash& h, bool /*force_light_mode*/)
{
MutexLock lock(m_requestMutex);
@@ -456,7 +456,7 @@ bool RandomX_Hasher_RPC::calculate(const void* data_ptr, size_t size, uint64_t h
s << "{\"jsonrpc\":\"2.0\",\"id\":\"0\",\"method\":\"calc_pow\",\"params\":{\"major_version\":" << major_version <<
",\"height\":" << height <<
",\"block_blob\":\"" << log::hex_buf(data, size) << '"' <<
",\"seed_hash\":\"\"}}" << '\0';
",\"seed_hash\":\"" << seed << "\"}}" << '\0';
std::atomic<int> result{ 0 };
std::atomic<bool> done{ false };
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+17
View File
@@ -1,3 +1,20 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#if defined(_MSC_VER) && defined(__cppcheck__)
// cppcheck chokes on rapidjson headers in Windows
#else
+53 -11
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -623,6 +623,7 @@ bool SideChain::add_external_block(PoolBlock& block, std::vector<hash>& missing_
LOGERR(0, "UNSTABLE HARDWARE DETECTED: Calculated the same hash twice, got different results: " << block.m_powHash << " != " << pow_hash2 << " (sidechain id = " << block.m_sidechainId << ')');
if (block.m_difficulty.check_pow(pow_hash2)) {
LOGINFO(3, "add_external_block second result has enough PoW for height = " << block.m_sidechainHeight << ", id = " << block.m_sidechainId);
block.m_powHash = pow_hash2;
not_enough_pow = false;
}
}
@@ -702,6 +703,13 @@ bool SideChain::add_block(const PoolBlock& block)
m_seenOnionPubkeys[h] = new_block->m_localTimestamp;
}
auto it2 = new_block->m_mergeMiningExtra.find(keccak_i2p_b32_address);
if ((it2 != new_block->m_mergeMiningExtra.end()) && (it2->second.size() >= HASH_SIZE)) {
hash h;
memcpy(h.h, it2->second.data(), HASH_SIZE);
m_seenI2PDestHashes[h] = new_block->m_localTimestamp;
}
prune_seen_data();
}
@@ -1156,7 +1164,7 @@ void SideChain::prune_seen_data()
{
const uint64_t cur_time = seconds_since_epoch();
// Every 5 minutes, delete wallets that weren't seen for more than 72 hours and onion pubkeys that weren't seen for more than 12 hours
// Every 5 minutes, delete wallets that haven't been seen for more than 72 hours and onion/I2P identifiers that haven't been seen for more than 12 hours
if (m_seenWalletsLastPruneTime + 5ul * 60ul <= cur_time) {
auto prune = [cur_time](auto& data, uint64_t timeout) {
for (auto it = data.begin(); it != data.end();) {
@@ -1173,6 +1181,7 @@ void SideChain::prune_seen_data()
prune(m_seenWallets, 72 * hour);
prune(m_seenOnionPubkeys, 12 * hour);
prune(m_seenI2PDestHashes, 12 * hour);
m_seenWalletsLastPruneTime = cur_time;
}
@@ -1366,7 +1375,7 @@ bool SideChain::p2pool_update_available() const
}
// Assume that a new version is out if >= 20% of hashrate is using it already
return newer_p2pool_diff * 5 >= total_p2pool_diff;
return !total_p2pool_diff.empty() && (newer_p2pool_diff * 5 >= total_p2pool_diff);
}
std::vector<hash> SideChain::seen_onion_pubkeys() const
@@ -1401,6 +1410,38 @@ void SideChain::add_onion_pubkeys(const std::vector<hash>& pubkeys)
}
}
std::vector<hash> SideChain::seen_i2p_dest_hashes() const
{
std::vector<hash> result;
ReadLock lock(m_seenDataLock);
result.reserve(m_seenI2PDestHashes.size());
for (const auto& it : m_seenI2PDestHashes) {
result.push_back(it.first);
}
return result;
}
void SideChain::add_i2p_dest_hashes(const std::vector<hash>& dest_hashes)
{
if (dest_hashes.empty()) {
return;
}
const uint64_t cur_time = seconds_since_epoch();
WriteLock lock(m_seenDataLock);
for (const hash& h : dest_hashes) {
if (!h.empty()) {
m_seenI2PDestHashes[h] = cur_time;
}
}
}
void SideChain::verify_loop(PoolBlock* block)
{
// PoW is already checked at this point
@@ -2171,8 +2212,8 @@ void SideChain::update_depths(PoolBlock* block)
void SideChain::prune_old_blocks()
{
// Leave 2 minutes worth of spare blocks in addition to 2xPPLNS window for lagging nodes which need to sync
const uint64_t prune_distance = (m_chainWindowSize - 1) * 2 + UNCLE_BLOCK_DEPTH * 2 + MONERO_BLOCK_TIME / m_targetBlockTime;
// Leave >2 minutes worth of spare blocks in addition to 2xPPLNS window for lagging nodes which need to sync
const uint64_t prune_distance = (m_chainWindowSize - 1) * 2 + UNCLE_BLOCK_DEPTH * 2 + MONERO_BLOCK_TIME / m_targetBlockTime + 1;
// Remove old blocks from alternative unconnected chains after long enough time
const uint64_t cur_time = seconds_since_epoch();
@@ -2180,7 +2221,7 @@ void SideChain::prune_old_blocks()
const PoolBlock* tip = m_chainTip;
if (tip->m_sidechainHeight < prune_distance) {
if (!tip || (tip->m_sidechainHeight < prune_distance)) {
return;
}
@@ -2188,18 +2229,19 @@ void SideChain::prune_old_blocks()
std::vector<PoolBlock*> blocks_to_prune;
for (auto it = m_blocksByHeight.begin(); (it != m_blocksByHeight.end()) && (it->first <= h);) {
for (auto it = m_blocksByHeight.begin(); (it != m_blocksByHeight.end()) && (it->first < h);) {
const uint64_t height = it->first;
std::vector<PoolBlock*>& v = it->second;
v.erase(std::remove_if(v.begin(), v.end(),
[this, prune_distance, cur_time, prune_delay, &blocks_to_prune, height](PoolBlock* block)
{
if ((block->m_depth >= prune_distance) || (cur_time >= block->m_localTimestamp + prune_delay)) {
if ((block->m_depth > prune_distance) || (cur_time >= block->m_localTimestamp + prune_delay)) {
blocks_to_prune.push_back(block);
auto it2 = m_blocksById.find(block->m_sidechainId);
if (it2 != m_blocksById.end()) {
m_blocksById.erase(it2);
blocks_to_prune.push_back(block);
}
else {
LOGERR(1, "m_blocksByHeight and m_blocksById are inconsistent at height " << height << ". Fix the code!");
@@ -2227,7 +2269,7 @@ void SideChain::prune_old_blocks()
}
if (!blocks_to_prune.empty()) {
LOGINFO(4, "pruned " << blocks_to_prune.size() << " old blocks at heights <= " << h);
LOGINFO(4, "pruned " << blocks_to_prune.size() << " old blocks at heights < " << h);
// If side-chain started pruning blocks it means the initial sync is complete
// It's now safe to delete cached blocks
@@ -2445,7 +2487,7 @@ void SideChain::precalc_worker()
do {
const PoolBlock* job;
{
MutexLock lock(m_precalcJobsMutex);
+6 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -76,6 +76,7 @@ public:
[[nodiscard]] uint64_t block_time() const { return m_targetBlockTime; }
[[nodiscard]] FORCEINLINE uint64_t miner_count() const { ReadLock lock(m_seenDataLock); return m_seenWallets.size(); }
[[nodiscard]] FORCEINLINE uint64_t onion_pubkeys_count() const { ReadLock lock(m_seenDataLock); return m_seenOnionPubkeys.size(); }
[[nodiscard]] FORCEINLINE uint64_t i2p_dest_hashes_count() const { ReadLock lock(m_seenDataLock); return m_seenI2PDestHashes.size(); }
[[nodiscard]] uint64_t last_updated() const;
[[nodiscard]] bool is_default() const;
[[nodiscard]] bool is_mini() const;
@@ -90,6 +91,9 @@ public:
[[nodiscard]] std::vector<hash> seen_onion_pubkeys() const;
void add_onion_pubkeys(const std::vector<hash>& pubkeys);
[[nodiscard]] std::vector<hash> seen_i2p_dest_hashes() const;
void add_i2p_dest_hashes(const std::vector<hash>& dest_hashes);
#ifdef P2POOL_UNIT_TESTS
difficulty_type m_testMainChainDiff;
const unordered_map<hash, PoolBlock*>& blocksById() const { return m_blocksById; }
@@ -129,6 +133,7 @@ private:
mutable ReadWriteLock m_seenDataLock;
unordered_map<hash, uint64_t> m_seenWallets;
unordered_map<hash, uint64_t> m_seenOnionPubkeys;
unordered_map<hash, uint64_t> m_seenI2PDestHashes;
uint64_t m_seenWalletsLastPruneTime;
// Used to quickly cut off multiple broadcasts of the same block by different peers. Only the first broadcast will be processed.
+77 -21
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -40,11 +40,12 @@ static constexpr uint64_t AUTODIFF_START = std::numeric_limits<uint64_t>::max()
static constexpr int32_t BAD_SHARE_POINTS = -5;
static constexpr int32_t GOOD_SHARE_POINTS = 1;
static constexpr int32_t BAN_THRESHOLD_POINTS = -15;
static constexpr int32_t MAX_SCORE = 1000;
namespace p2pool {
StratumServer::StratumServer(p2pool* pool)
: TCPServer(DEFAULT_BACKLOG, StratumClient::allocate, std::string())
: TCPServer(DEFAULT_BACKLOG, StratumClient::allocate, std::string(), Params::ProxyType::INVALID, pool->params().m_stratumProxyProtocol)
, m_pool(pool)
, m_autoDiff(pool->params().m_autoDiff)
, m_enableFullValidation(pool->params().m_enableFullValidation)
@@ -70,6 +71,7 @@ StratumServer::StratumServer(p2pool* pool)
m_hashrateData[0] = { seconds_since_epoch(), 0 };
uv_mutex_init_checked(&m_resetShareCountersLock);
uv_mutex_init_checked(&m_blobsQueueLock);
uv_mutex_init_checked(&m_showWorkersLock);
uv_mutex_init_checked(&m_rngLock);
@@ -77,6 +79,9 @@ StratumServer::StratumServer(p2pool* pool)
m_extraNonce = get_random32();
uv_async_init_checked(&m_loop, &m_resetShareCountersAsync, on_reset_share_counters);
m_resetShareCountersAsync.data = this;
uv_async_init_checked(&m_loop, &m_blobsAsync, on_blobs_ready);
m_blobsAsync.data = this;
m_blobsQueue.reserve(2);
@@ -101,6 +106,7 @@ StratumServer::~StratumServer()
}
}
uv_mutex_destroy(&m_resetShareCountersLock);
uv_mutex_destroy(&m_blobsQueueLock);
uv_mutex_destroy(&m_showWorkersLock);
uv_mutex_destroy(&m_rngLock);
@@ -139,11 +145,17 @@ void StratumServer::on_block(const BlockTemplate& block)
// Integrity checks
if (blobs_data->m_blobSize < 76) {
LOGERR(1, "internal error: get_hashing_blobs returned too small blobs (" << blobs_data->m_blobSize << " bytes)");
delete blobs_data;
return;
}
else if (blobs_data->m_blobs.size() != blobs_data->m_blobSize * num_connections) {
if (blobs_data->m_blobs.size() != blobs_data->m_blobSize * num_connections) {
LOGERR(1, "internal error: get_hashing_blobs returned wrong amount of data");
delete blobs_data;
return;
}
else if (pool_block_debug() && (num_connections > 1)) {
if (pool_block_debug() && (num_connections > 1)) {
std::vector<uint64_t> blob_hashes;
blob_hashes.reserve(num_connections);
@@ -161,7 +173,8 @@ void StratumServer::on_block(const BlockTemplate& block)
for (uint32_t i = 1; i < num_connections; ++i) {
if (blob_hashes[i - 1] == blob_hashes[i]) {
LOGERR(1, "internal error: get_hashing_blobs returned two identical blobs");
break;
delete blobs_data;
return;
}
}
}
@@ -312,13 +325,14 @@ bool StratumServer::on_login(StratumClient* client, uint32_t id, const char* log
}
client->m_lastJobTarget = target;
const bool result = send(client,
[client, id, &hashing_blob, job_id, blob_size, target, height, &seed_hash](uint8_t* buf, size_t buf_size)
{
do {
client->m_rpcId = static_cast<StratumServer*>(client->m_owner)->get_random32();
} while (!client->m_rpcId);
uint32_t rpc_id;
do {
rpc_id = static_cast<StratumServer*>(client->m_owner)->get_random32();
} while (!rpc_id);
const bool result = send(client,
[rpc_id, id, &hashing_blob, job_id, blob_size, target, height, &seed_hash](uint8_t* buf, size_t buf_size)
{
log::hex_buf target_hex(&target);
if (target >= TARGET_4_BYTES_LIMIT) {
@@ -328,7 +342,7 @@ bool StratumServer::on_login(StratumClient* client, uint32_t id, const char* log
log::Stream s(buf, buf_size);
s << "{\"id\":" << id << ",\"jsonrpc\":\"2.0\",\"result\":{\"id\":\"";
s << log::Hex(client->m_rpcId) << "\",\"job\":{\"blob\":\"";
s << log::Hex(rpc_id) << "\",\"job\":{\"blob\":\"";
s << log::hex_buf(hashing_blob, blob_size) << "\",\"job_id\":\"";
s << log::Hex(job_id) << "\",\"target\":\"";
s << target_hex << "\",\"algo\":\"rx/0\",\"height\":";
@@ -337,6 +351,10 @@ bool StratumServer::on_login(StratumClient* client, uint32_t id, const char* log
return s.m_pos;
});
if (result) {
client->m_rpcId = rpc_id;
}
return result;
}
@@ -480,6 +498,8 @@ bool StratumServer::on_submit(StratumClient* client, uint32_t id, const char* jo
update_auto_diff(client, share.m_timestamp, share.m_hashes);
++client->m_stratumShares;
// If this share is below sidechain difficulty, process it in this thread because it'll be quick
if (!share.m_highEnoughDifficulty && !m_enableFullValidation) {
on_share_found(&share.m_req);
@@ -565,6 +585,7 @@ void StratumServer::show_workers()
<< log::pad_right("uptime", 20)
<< log::pad_right("difficulty", 20)
<< log::pad_right("hashrate", 15)
<< log::pad_right("shares", 12)
<< "name"
);
@@ -585,11 +606,16 @@ void StratumServer::show_workers()
constexpr bool is_tls = false;
#endif
char shares_buf[16] = {};
log::Stream s(shares_buf);
s << c->m_sidechainShares << '/' << c->m_stratumShares << '\0';
LOGINFO(0, log::pad_right(static_cast<const char*>(c->m_addrString), addr_len + 8)
<< (is_tls ? "yes " : "no ")
<< log::pad_right(log::Duration(cur_time - c->m_connectedTime), 20)
<< log::pad_right(diff, 20)
<< log::pad_right(log::Hashrate(c->m_autoDiff.lo / AUTO_DIFF_TARGET_TIME, m_autoDiff && (c->m_autoDiff != 0)), 15)
<< log::pad_right(static_cast<const char*>(shares_buf), 12)
<< (c->m_rpcId ? c->m_customUser : "not logged in")
);
++n;
@@ -600,6 +626,22 @@ void StratumServer::show_workers()
void StratumServer::reset_share_counters()
{
MutexLock lock(m_resetShareCountersLock);
if (!uv_is_closing(reinterpret_cast<uv_handle_t*>(&m_resetShareCountersAsync))) {
uv_async_send(&m_resetShareCountersAsync);
}
}
void StratumServer::on_reset_share_counters()
{
check_event_loop_thread(__func__);
for (StratumClient* c = static_cast<StratumClient*>(m_connectedClientsList->m_next); c != m_connectedClientsList; c = static_cast<StratumClient*>(c->m_next)) {
c->m_stratumShares = 0;
c->m_sidechainShares = 0;
}
WriteLock lock(m_hashrateDataLock);
m_cumulativeHashesAtLastShare = m_cumulativeHashes;
@@ -942,16 +984,16 @@ void StratumServer::on_share_found(uv_work_t* req)
SubmittedShare* share = reinterpret_cast<SubmittedShare*>(req->data);
StratumServer* server = share->m_server;
if (share->m_allocated) {
BACKGROUND_JOB_START(StratumServer::on_share_found);
}
if (server->is_banned(share->m_clientIPv6, share->m_clientAddr)) {
share->m_highEnoughDifficulty = false;
share->m_result = SubmittedShare::Result::BANNED;
return;
}
if (share->m_highEnoughDifficulty || server->m_enableFullValidation) {
BACKGROUND_JOB_START(StratumServer::on_share_found);
}
p2pool* pool = server->m_pool;
const uint64_t target = share->m_target;
@@ -1058,10 +1100,13 @@ void StratumServer::on_after_share_found(uv_work_t* req, int /*status*/)
server->check_event_loop_thread(__func__);
bool share_found = false;
if (share->m_highEnoughDifficulty) {
const char* s = share->m_clientCustomUser;
if (share->m_result == SubmittedShare::Result::OK) {
LOGINFO(0, log::Green() << "SHARE FOUND: mainchain height " << share->m_mainchainHeight << ", sidechain height " << share->m_sidechainHeight << ", diff " << share->m_sidechainDifficulty << ", client " << static_cast<char*>(share->m_clientAddrString) << (*s ? ", user " : "") << s << ", effort " << share->m_effort << '%');
share_found = true;
}
else {
static const char* reason_list[] = {
@@ -1079,10 +1124,6 @@ void StratumServer::on_after_share_found(uv_work_t* req, int /*status*/)
}
}
if (share->m_highEnoughDifficulty || server->m_enableFullValidation) {
BACKGROUND_JOB_STOP(StratumServer::on_share_found);
}
const bool bad_share = (share->m_result == SubmittedShare::Result::LOW_DIFF) || (share->m_result == SubmittedShare::Result::INVALID_POW);
StratumClient* client = share->m_client;
@@ -1115,7 +1156,11 @@ void StratumServer::on_after_share_found(uv_work_t* req, int /*status*/)
return s.m_pos;
});
client->m_score += share->m_score;
client->m_score = std::min(client->m_score + share->m_score, MAX_SCORE);
if (share_found) {
++client->m_sidechainShares;
}
if (bad_share && (client->m_score <= BAN_THRESHOLD_POINTS)) {
client->ban(server->m_banTime);
@@ -1151,11 +1196,17 @@ void StratumServer::on_after_share_found(uv_work_t* req, int /*status*/)
}
LOGINFO(5, "on_after_share_found: pending share checks count = " << server->m_pendingShareChecks.size());
BACKGROUND_JOB_STOP(StratumServer::on_share_found);
}
}
void StratumServer::on_shutdown()
{
{
MutexLock lock(m_resetShareCountersLock);
uv_close(reinterpret_cast<uv_handle_t*>(&m_resetShareCountersAsync), nullptr);
}
{
MutexLock lock(m_blobsQueueLock);
uv_close(reinterpret_cast<uv_handle_t*>(&m_blobsAsync), nullptr);
@@ -1181,6 +1232,8 @@ StratumServer::StratumClient::StratumClient()
, m_customUser{}
, m_lastJobTarget(0)
, m_score(0)
, m_stratumShares(0)
, m_sidechainShares(0)
{
m_rawReadBuf[0] = '\0';
m_stratumReadBuf[0] = '\0';
@@ -1210,6 +1263,9 @@ void StratumServer::StratumClient::reset()
m_lastJobTarget = 0;
m_score = 0;
m_stratumShares = 0;
m_sidechainShares = 0;
}
bool StratumServer::StratumClient::on_connect()
+10 -1
View File
@@ -1,6 +1,6 @@
/*
* This file is part of the Monero P2Pool <https://github.com/SChernykh/p2pool>
* Copyright (c) 2021-2025 SChernykh <https://github.com/SChernykh>
* Copyright (c) 2021-2026 SChernykh <https://github.com/SChernykh>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -91,6 +91,9 @@ public:
uint64_t m_lastJobTarget;
int32_t m_score;
uint32_t m_stratumShares;
uint32_t m_sidechainShares;
};
[[nodiscard]] bool on_login(StratumClient* client, uint32_t id, const char* login);
@@ -128,6 +131,12 @@ private:
hash m_seedHash;
};
uv_mutex_t m_resetShareCountersLock;
uv_async_t m_resetShareCountersAsync;
static void on_reset_share_counters(uv_async_t* handle) { reinterpret_cast<StratumServer*>(handle->data)->on_reset_share_counters(); }
void on_reset_share_counters();
uv_mutex_t m_blobsQueueLock;
uv_async_t m_blobsAsync;
std::vector<BlobsData*> m_blobsQueue;

Some files were not shown because too many files have changed in this diff Show More