Compare commits

..

36 Commits

Author SHA1 Message Date
Codex Bot 1f72c33b02 Merge remote-tracking branch 'origin/master' into develop 2026-05-07 01:17:25 +02:00
Codex Bot 3759b59e6b Stabilize nodejs facade submissions 2026-05-07 01:15:47 +02:00
SChernykh 3e88a90d61 Build scripts: use gcc 16 2026-05-04 21:37:34 +02:00
SChernykh 3eae86d1eb Fixed port numbers in I2P docs 2026-05-03 13:06:47 +02:00
SChernykh e04a5500aa Made README.md up to date 2026-05-03 11:32:11 +02:00
Codex Bot ba570f2de9 Scale hashing blob batch by worker count 2026-05-03 10:25:00 +02:00
Codex Bot f29afbb2a5 Add nodejs pool extra nonce support 2026-05-02 23:33:23 +02:00
SChernykh 3b30129a4e P2PServer - added more checks 2026-05-02 17:43:06 +02:00
SChernykh 5733c4eae9 GCC 16 (mingw) fix 2026-05-02 13:30:06 +02:00
Codex Bot a4134bde72 Add nodejs pool facade for Monero P2Pool 2026-05-02 09:53:27 +02:00
SChernykh 77ad87cee5 Check for max value in split_reward 2026-05-02 07:45:15 +02:00
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
56 changed files with 1565 additions and 298 deletions
+7 -7
View File
@@ -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
@@ -196,7 +196,7 @@ jobs:
- 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
@@ -273,7 +273,7 @@ jobs:
- 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
@@ -360,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
@@ -499,7 +499,7 @@ jobs:
- name: Build libcurl
run: |
cd external/src/curl
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_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
@@ -566,7 +566,7 @@ jobs:
- name: Build libcurl
run: |
cd external/src/curl
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_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
@@ -655,7 +655,7 @@ 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
+2 -2
View File
@@ -54,7 +54,7 @@ jobs:
# 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
+4
View File
@@ -31,6 +31,10 @@ jobs:
name: Analyze
timeout-minutes: 240
runs-on: windows-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
+3 -3
View File
@@ -34,7 +34,7 @@ jobs:
- 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
@@ -125,7 +125,7 @@ jobs:
- name: Build libcurl
run: |
cd external/src/curl
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_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
@@ -364,7 +364,7 @@ jobs:
- name: Build libcurl
run: |
cd external/src/curl
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_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
+2
View File
@@ -117,6 +117,7 @@ set(HEADERS
src/merge_mining_client.h
src/merge_mining_client_json_rpc.h
src/merkle.h
src/nodejs_pool_rpc.h
src/p2p_server.h
src/p2pool.h
src/p2pool_api.h
@@ -153,6 +154,7 @@ set(SOURCES
src/merge_mining_client.cpp
src/merge_mining_client_json_rpc.cpp
src/merkle.cpp
src/nodejs_pool_rpc.cpp
src/p2p_server.cpp
src/p2pool.cpp
src/p2pool_api.cpp
+28 -26
View File
@@ -35,19 +35,19 @@ These are 3rd-party pages. If they are down, it doesn't mean there is a problem
- [General Considerations](#general-considerations)
- [GUI for P2Pool](#gui-for-p2pool)
- [Merge mining](#merge-mining)
- [GNU/Linux](#gnulinux)
- [Windows](#windows)
- [Mining on GNU/Linux](#gnulinux)
- [Mining on Windows](#windows)
- [Build instructions](#build-instructions)
- [Reproducible builds](#reproducible-builds)
- [Donations](#donations)
## Pool mining vs Solo mining vs P2Pool mining
Here's the comparison table of the different ways of mining. While pool mining is the easiest to setup, it centralizes Monero network and pool admin gets full power over your hashrate and your unpaid funds. Solo mining is 100% independent and the best for the network. P2Pool mining has all the advantages of solo mining, but also makes regular payouts possible.
Here's the comparison table of the different ways of mining. While pool mining is the easiest to set up, it centralizes the Monero network and the pool admin gets full power over your hashrate and your unpaid funds. Solo mining is 100% independent and the best for the network. P2Pool mining has all the advantages of solo mining, but also makes regular payouts possible.
|Pool type|Payouts|Fee|Min. payout|Centralized?|Stability|Control|Setup
|-|-|-|-|-|-|-|-|
|Centralized pool|Regular|0-3%|0.001-0.01 XMR|Yes|Less stable due to pool server outages|Pool admin controls your mined funds, what you mine and can execute network attacks|Only miner software is required
|Centralized pool|Regular|0-3%|0.001-0.01 XMR|Yes|Less stable due to pool server outages|The pool admin controls your mined funds and what you mine, and can execute attacks against the network|Only miner software is required
|Solo|Rare|0%|0.6 XMR or more|No|As stable as your Monero node|100% under your control|Monero node + optional miner
|**P2Pool**|Regular|0%|~0.00027 XMR|No|Very stable: node failover and multiple Monero nodes are supported|100% under your control|Monero node(s) + P2Pool node(s) + optional miner(s)
@@ -63,14 +63,14 @@ Here's the comparison table of the different ways of mining. While pool mining i
* Fast block times, down to 1 second
* Uncle blocks are supported to avoid orphans - all your shares will be accounted for!
* Configurable PPLNS window size and block time
* Advanced mempool picking algorithm, it creates blocks with better reward than what monerod solo mining does
* Advanced mempool picking algorithm: it creates blocks with better rewards 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) and [I2P](docs/I2P.MD) are fully supported
* Mining through [TOR](docs/TOR.MD) and [I2P](docs/I2P.MD) is fully supported
## How payouts work in P2Pool
First you need to find a pool share. This share will stay in [PPLNS](https://en.wikipedia.org/wiki/Mining_pool#Pay-per-last-N-shares) window for up to 2160 pool blocks (6 hours, auto adjustable to balance payout sizes and frequency). The moment P2Pool finds a Monero block and you have at least 1 pool share in PPLNS window, you'll get a payout! Monero block reward is split between all miner wallets in PPLNS window. Each miner gets a part of block reward proportional to the total difficulty of his/her shares in PPLNS window.
First you need to find a pool share. This share will stay in [PPLNS](https://en.wikipedia.org/wiki/Mining_pool#Pay-per-last-N-shares) window for up to 2160 pool blocks (6 hours, auto adjustable to balance payout sizes and frequency). The moment P2Pool finds a Monero block and you have at least 1 pool share in PPLNS window, you'll get a payout! Monero block reward is split between all miner wallets in PPLNS window. Each miner gets a part of the block reward proportional to the total difficulty of his/her shares in PPLNS window.
**NOTE** If P2Pool doesn't have enough hashrate to find Monero blocks faster than every 6 hours on average (~15 MH/s), **not all your pool shares will result in a payout**. Even if pool hashrate is higher, bad luck can sometimes result in a share going through PPLNS window without a payout. But in the long run it will be compensated by other shares receiving multiple payouts - your payouts will average out to what you'd get with regular pool mining.
@@ -89,7 +89,7 @@ In order to continue mining on P2Pool, you must update both Monero and P2Pool so
|Monero protocol version|Required Monero software version|Required P2Pool version
|-|-|-|
|v15, v16 (active after August 13th, 2022)|v0.18.0.0 or newer, v0.18.4.2 is recommended|v4.0 or newer
|v15, v16 (active after August 13th, 2022)|v0.18.0.0 or newer, v0.18.4.6 or newer is recommended|v4.0 or newer
## How to mine on P2Pool
@@ -97,7 +97,7 @@ In order to continue mining on P2Pool, you must update both Monero and P2Pool so
- 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.
- 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 mine to a primary wallet address (the one starting with `4`). 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` or `--nano` parameter to your P2Pool command to connect to the respective sidechain.
> [!NOTE]
> You cannot use both `--mini` and `--nano` together<br>
@@ -124,7 +124,7 @@ In order to continue mining on P2Pool, you must update both Monero and P2Pool so
Merge mining is available in P2Pool since the fork that happened on October 12th, 2024. Version 4.0 or newer is required to use it.
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)
- [Townforge](https://townforge.net/) supports merge mining (but Townforge is still in testnet phase)
- [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
@@ -144,7 +144,7 @@ TARI_NODE_IP is 127.0.0.1 if you run both on the same machine (recommended).
Merge mining is available on Tari's mainnet:
- Download [Tari suite](https://github.com/tari-project/tari/releases/latest) for your OS
- Run Minotari node and wait until in synchronizes
- Run Minotari node and wait until it synchronizes
- Run Minotari console wallet to create a Tari wallet
- Copy the "Tari Address one-sided" from the "Receive" tab of the wallet
- Paste it into the P2Pool command line above
@@ -152,7 +152,7 @@ Merge mining is available on Tari's mainnet:
Note that Tari will be mined in solo mode (only full Tari blocks can be mined for now). This doesn't affect P2Pool payouts - they will stay the same.
### GNU/Linux
### Mining on GNU/Linux
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).
@@ -180,7 +180,7 @@ The `--zmq-pub` option is required for P2Pool to work properly.
6. Start P2Pool with the following command/options:
```
./p2pool --host 127.0.0.1 --wallet YOUR_WALLET_ADDRESS
./p2pool --host 127.0.0.1 --wallet YOUR_WALLET_ADDRESS --mini
```
7. Wait until the initial P2Pool sync is finished (shouldn't take more than 5-10 minutes).
8. Start XMRig with the following command/options:
@@ -195,7 +195,7 @@ The `--zmq-pub` option is required for P2Pool to work properly.
9. XMRig should connect and start mining!
**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/
- 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:
```
grep -E 'WARNING|ERROR' p2pool.log
@@ -213,9 +213,9 @@ nocreate
}
```
### Windows
### Mining on 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.*
**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 clicking "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.*
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).
@@ -223,7 +223,7 @@ nocreate
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):
- On Windows 10 or above, run XMRig at least once as Administrator (right-click Run As Administrator)
- 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.
7. Open a command prompt and navigate to the folder where you extracted P2Pool.
@@ -273,11 +273,11 @@ PAUSE
```
## Build instructions
Only 64-bit builds are supported, in particular ARMv7 or older CPUs are not supported. The reason is that RandomX hashing algorithm is too slow in 32-bit mode, and P2Pool needs to check new blocks very fast to keep up with other nodes.
Only 64-bit builds are supported. In particular, ARMv7 and older CPUs are not supported. The reason is that RandomX hashing algorithm is too slow in 32-bit mode, and P2Pool needs to check new blocks very fast to keep up with other nodes.
### Prerequisites
- cmake >= 3.10
- C++ compiler with C++17 support. GCC-8, Clang-13 and MSVC-2019 have been tested and confirmed to work, older compilers may fail to build P2Pool.
- C++ compiler with C++17 support. GCC-8, Clang-13 and MSVC-2019 have been tested and confirmed to work. Older compilers may fail to build P2Pool.
### Ubuntu 20.04
@@ -300,7 +300,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.
The commands below use the new flake specific reference-format, so be sure to also set `ca-references` in `--experimental-features`.
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:
```
@@ -378,19 +378,21 @@ Anyone can run the same build script on the same source code, and get the same r
Prerequisites: Ubuntu with Docker and Git installed.
Example of building v4.9 release binaries:
Example of building v4.15 release binaries:
```
git clone --branch v4.9 --recursive https://github.com/SChernykh/p2pool
p2pool/scripts/release/build_all.sh v4.9
git clone --branch v4.15 --recursive https://github.com/SChernykh/p2pool
p2pool/scripts/release/build_all.sh v4.15
```
The binaries will be created in `p2pool/scripts/release` folder. First time you run it, it will take up to several hours to first build the Docker image with all the necessary tools in it. Wait until all builds are finished and then run
The binaries will be created in `p2pool/scripts/release` folder. The first time you run it, it will take up to several hours to first build the Docker image with all the necessary tools in it. Wait until all builds are finished and then run
```
cd p2pool/scripts/release
./gen_sums.sh
```
to generate the hash sums and compare them with the official release's hash sums.
Reproducible builds of (almost) all commits are available [here](https://p2pool.io/builds/). These builds use the release build scripts, so they can act as a "latest release" for all means and purposes, but they might be less stable than the official releases.
## Donations
If you'd like to support further development of Monero P2Pool, you're welcome to send any amount of XMR to the following address:
@@ -399,7 +401,7 @@ If you'd like to support further development of Monero P2Pool, you're welcome to
44MnN1f3Eto8DZYUWuE5XZNUtE3vcRzt2j6PzqWpPau34e6Cf4fAxt6X2MBmrm6F9YMEiMNjN6W4Shn4pLcfNAja621jwyg
```
Starting from v4.6, P2Pool will also have an ability to merge mine donations for the author.
Starting from v4.6, P2Pool also has an ability to merge mine donations for the author.
Note that this will not affect your hashrate or payouts in any way. P2Pool will always (100% of the time) keep mining to your configured Monero wallet address, but it might also use the available merge mining capacity to donate to the author.
@@ -407,4 +409,4 @@ If you merge mine yourself, your settings will take priority.
The merge mining donation runs without a donation server - there is no "phoning home" to a server, everything is done through the P2Pool's network in a decentralized way.
To opt out of this, build P2Pool with `-DWITH_MERGE_MINING_DONATION=OFF` in cmake command line. Due to the architecture of the decentralized P2Pool network, your node will still relay donation messages to other nodes even if you opted out (but it will not process them).
To opt out of this, build P2Pool with `-DWITH_MERGE_MINING_DONATION=OFF` in the cmake command line. Due to the architecture of the decentralized P2Pool network, your node will still relay donation messages to other nodes even if you opted out (but it will not process them).
+5 -4
View File
@@ -23,10 +23,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(WARNING_FLAGS "${WARNING_FLAGS} -Wstrict-overflow=2")
endif()
if (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15))
set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-cpp")
endif()
if (DISABLE_WARNINGS)
set(WARNING_FLAGS "-w")
endif()
@@ -40,6 +36,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
endif()
set(OPTIMIZATION_FLAGS "${OPTIMIZATION_FLAGS} -g3 -ftrapv")
else()
# Looks like this warning is a false positive on GCC 16.1 (mingw) at -O2/-O3 optimization level
if (MINGW AND (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16)))
set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-array-bounds")
endif()
set(OPTIMIZATION_FLAGS "-O3 -ffast-math -s")
endif()
+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
+3
View File
@@ -14,6 +14,9 @@
--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
+3 -3
View File
@@ -16,12 +16,12 @@ Follow [these instructions](https://docs.i2pd.website/en/latest/user-guide/insta
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:
Add a server tunnel to allow inbound connections from peers and use port number 37888 for p2pool-mini, 37890 for p2pool-nano:
```ini
[p2pool]
type = server
host = 127.0.0.1
port = 28723
port = 37889
keys = p2pool.dat
```
This will create a hidden service key in `/var/lib/i2pd/p2pool.dat`; you may want to back this up.
@@ -34,7 +34,7 @@ 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"
curl -s http://127.0.0.1:7070/?page=i2p_tunnels | grep -Eo "[a-zA-Z0-9./?=_%:-]*" | grep "37889"
```
The resulting `.b32.i2p` address should then be used for the `--i2p-address` command-line parameter.
+2 -2
View File
@@ -11,12 +11,12 @@ if [ $? -ne 0 ]; then
images/ubuntu/build.sh
fi
for i in 8 15;
for i in 8 16;
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
@@ -120,6 +120,20 @@ mkdir build && cd build
make -j$(nproc)
make install
echo "Installing GCC 16.1.0"
cd /root
git clone --depth 1 --branch releases/gcc-16.1.0 --jobs $(nproc) git://gcc.gnu.org/git/gcc.git gcc-16
cd gcc-16
contrib/download_prerequisites
mkdir build && cd build
../configure --enable-languages=c,c++ --disable-multilib --disable-bootstrap --prefix=/usr/local/gcc-16
make -j$(nproc)
make install
echo "Installing clang"
cd /root
@@ -127,7 +141,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
+10 -10
View File
@@ -3,14 +3,14 @@ set -e
# Software versions to install
_7ZIP_VERSION=2600
_7ZIP_VERSION=2601
BINUTILS_VERSION=2_46
CLANG_VERSION=21.1.8
CMAKE_VERSION=4.3.1
CMAKE_VERSION=4.3.2
FREEBSD_VERSION=12.4
GCC_VERSION=15.2.0
GCC_VERSION=16.1.0
GLIBC_VERSION=2.43
LINUX_HEADERS_VERSION=6.19.12
LINUX_HEADERS_VERSION=6.19.14
MACOSX_SDK_VERSION=26.1
OSXCROSS_VERSION=2bc739ebe45db5d72e176d2a4e1c7dd95464e8e2
MAKE_VERSION=4.4.1
@@ -18,12 +18,12 @@ MINGW_VERSION=14.0.0
XZ_VERSION=5.8.3
TAR_VERSION=1.35
_7ZIP_SHA256="c74dc4a48492cde43f5fec10d53fb2a66f520e4a62a69d630c44cb22c477edc6"
CMAKE_SHA256="208d76804009cbe8ec9aea0aa052c857c6e59bd289b43b9941c99324dc78b1d8"
_7ZIP_SHA256="8ea0fc8a135e7b848e80a4116fe22dff56c8c4518dde1f43cce67f4e340b437a"
CMAKE_SHA256="791ae3604841ca03cb3889a3ad89165346e4b180ae3448efd4b0caa9ef46d245"
FREEBSD_AARCH64_SHA256="6c401819bfb93e810c9f9aa670a1e4685f924df5e7e0c9c6397dd6c16c954fa2"
FREEBSD_X86_64_SHA256="581c7edacfd2fca2bdf5791f667402d22fccd8a5e184635e0cac075564d57aa8"
GLIBC_SHA256="d9c86c6b5dbddb43a3e08270c5844fc5177d19442cf5b8df4be7c07cd5fa3831"
HEADERS_SHA256="ce5c4f1205f9729286b569b037649591555f31ca1e03cc504bd3b70b8e58a8d5"
HEADERS_SHA256="cde8bf6739be4a0777fedbbba5330b8188c55680c45a922a4dfa289cbec6f185"
MACOSX_SDK_SHA256="beee7212d265a6d2867d0236cc069314b38d5fb3486a6515734e76fa210c784c"
MAKE_SHA256="dd16fb1d67bfab79a72f5e8390735c49e3e8e70b4945a15ab1f81ddb78658fb3"
TAR_SHA256="4d62ff37342ec7aed748535323930c7cf94acf71c3591882b26a7ea50f3edc16"
@@ -269,7 +269,7 @@ echo "Install GCC for aarch64-linux-gnu"
cd /root
mkdir gcc_build_aarch64 && cd gcc_build_aarch64
../gcc/configure --target=aarch64-linux-gnu --enable-languages=c,c++ --disable-multilib
../gcc/configure --target=aarch64-linux-gnu --enable-languages=c,c++ --disable-multilib --disable-libatomic
make -j$(nproc) all-gcc
make install-gcc
@@ -321,7 +321,7 @@ echo "Install GCC for riscv64-linux-gnu"
cd /root
mkdir gcc_build_riscv64 && cd gcc_build_riscv64
../gcc/configure --target=riscv64-linux-gnu --enable-languages=c,c++ --disable-multilib
../gcc/configure --target=riscv64-linux-gnu --enable-languages=c,c++ --disable-multilib --disable-libatomic
make -j$(nproc) all-gcc
make install-gcc
@@ -380,7 +380,7 @@ echo "Install GCC for x86_64-w64-mingw32"
cd /root
mkdir gcc_build_w64 && cd gcc_build_w64
../gcc/configure --target=x86_64-w64-mingw32 --enable-languages=c,c++ --disable-multilib
../gcc/configure --target=x86_64-w64-mingw32 --enable-languages=c,c++ --disable-multilib --disable-libatomic
make -j$(nproc) all-gcc
make install-gcc
@@ -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
@@ -19,13 +19,13 @@ flags_datetime="-D__DATE__=\"\\\"$CURRENT_DATE\\\"\" -D__TIME__=\"\\\"$CURRENT_T
flags_libs="--target=x86_64-pc-windows-gnu -Os -flto -Wl,/timestamp:$BUILD_TIMESTAMP -fuse-ld=lld -w $flags_size $flags_datetime"
flags_p2pool="--target=x86_64-pc-windows-gnu -Wl,/timestamp:$BUILD_TIMESTAMP -fuse-ld=lld -femulated-tls -Wno-unused-command-line-argument -Wno-unknown-attributes $flags_size $flags_datetime"
flags_cxx_headers="-isystem /usr/local/x86_64-w64-mingw32/include/c++ -isystem /usr/local/x86_64-w64-mingw32/include/c++/15.2.0 -isystem /usr/local/x86_64-w64-mingw32/include"
flags_cxx_headers="-isystem /usr/local/x86_64-w64-mingw32/include/c++ -isystem /usr/local/x86_64-w64-mingw32/include/c++/16.1.0 -isystem /usr/local/x86_64-w64-mingw32/include"
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
+3 -2
View File
@@ -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();
@@ -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();
+4 -1
View File
@@ -111,7 +111,10 @@ private:
#ifdef P2POOL_UNIT_TESTS
BlockTemplate* m_oldTemplates[1] = {};
#else
BlockTemplate* m_oldTemplates[4] = {};
// Nodejs-pool submits can arrive noticeably later than native stratum
// submits. Keep enough old templates to rebuild aux proofs for delayed
// shares instead of failing with stale_template after a few rotations.
BlockTemplate* m_oldTemplates[512] = {};
#endif
std::atomic<uint64_t> m_finalReward;
+10 -10
View File
@@ -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,7 +172,7 @@ struct alignas(uint64_t) hash
}
}
explicit constexpr hash(const char (&s)[HASH_SIZE * 2 + 1]) : h{} {
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];
@@ -236,7 +236,7 @@ struct alignas(uint64_t) hash
uint64_t k = 0;
for (size_t i = 0; i < sizeof(uint64_t); ++i) {
k |= static_cast<uint64_t>(h[index * sizeof(uint64_t) + i]) << (i * sizeof(uint64_t));
k |= static_cast<uint64_t>(h[index * sizeof(uint64_t) + i]) << (i * 8);
}
return k;
@@ -417,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)
{
+3 -3
View File
@@ -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;
+15 -6
View File
@@ -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;
+93 -48
View File
@@ -27,7 +27,7 @@ namespace JSONRPCRequest {
struct CurlContext : public nocopy_nomove
{
CurlContext(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop);
CurlContext(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop, int timeout_seconds);
~CurlContext();
static int socket_func(CURL* easy, curl_socket_t s, int action, void* userp, void* socketp)
@@ -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;
@@ -82,13 +81,14 @@ struct CurlContext : public nocopy_nomove
uint64_t m_connectedTime;
std::string m_proxy;
int m_timeoutSeconds;
};
CurlContext::CurlContext(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop)
CurlContext::CurlContext(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop, int timeout_seconds)
: m_callback(cb)
, m_closeCallback(close_cb)
, m_loop(loop)
, m_timer{}
, m_timer(nullptr)
, m_multiHandle(nullptr)
, m_handle(nullptr)
, m_req(req)
@@ -96,9 +96,8 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
, m_startTime(0)
, m_connectedTime(0)
, m_proxy(proxy)
, m_timeoutSeconds(timeout_seconds)
{
BACKGROUND_JOB_START(CurlContext);
m_pollHandles.reserve(2);
{
@@ -132,18 +131,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 +144,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 +160,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 +169,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)
@@ -187,14 +181,21 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string
curl_easy_setopt_checked(m_handle, CURLOPT_WRITEFUNCTION, write_func);
curl_easy_setopt_checked(m_handle, CURLOPT_WRITEDATA, this);
int timeout = m_timeoutSeconds;
if (timeout <= 0) {
#ifdef DEV_TEST_SYNC
const int timeout = 10;
timeout = 10;
#else
const int timeout = proxy.empty() ? 1 : 5;
timeout = proxy.empty() ? 1 : 5;
#endif
}
curl_easy_setopt_checked(m_handle, CURLOPT_URL, m_url.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 +224,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 +233,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,8 +269,13 @@ 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;
try {
(*m_callback)(m_response.data(), m_response.size(), tcp_ping);
}
catch (...) {
}
}
delete m_callback;
if (m_response.empty()) {
@@ -264,10 +287,13 @@ CurlContext::~CurlContext()
}
}
try {
(*m_closeCallback)(m_error.c_str(), m_error.length(), tcp_ping);
delete m_closeCallback;
}
catch (...) {
}
curl_slist_free_all(m_headers);
delete m_closeCallback;
BACKGROUND_JOB_STOP(CurlContext);
}
@@ -348,12 +374,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 +393,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 +410,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 +482,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,12 +499,31 @@ 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;
});
}
}
void Call(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop)
void Call(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop, int timeout_seconds)
{
if (!loop) {
loop = uv_default_loop_checked();
@@ -492,11 +533,15 @@ void Call(const std::string& address, int port, const std::string& req, const st
[=]()
{
try {
new CurlContext(address, port, req, auth, proxy, ssl, ssl_fingerprint, cb, close_cb, loop);
new CurlContext(address, port, req, auth, proxy, ssl, ssl_fingerprint, cb, close_cb, loop, timeout_seconds);
}
catch (const std::exception& e) {
const char* msg = e.what();
try {
(*close_cb)(msg, strlen(msg), 0.0);
}
catch (...) {
}
delete cb;
delete close_cb;
}
+3 -3
View File
@@ -24,15 +24,15 @@ typedef Callback<void, const char* /*msg*/, size_t /*msg_size*/, double /*tcp_pi
FORCEINLINE static constexpr void dummy_callback(const char* /*msg*/, size_t /*msg_size*/, double /*tcp_ping*/) {}
void Call(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop);
void Call(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, CallbackBase* cb, CallbackBase* close_cb, uv_loop_t* loop, int timeout_seconds = 0);
template<typename T, typename U>
FORCEINLINE void call(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, T&& cb, U&& close_cb, uv_loop_t* loop = nullptr)
FORCEINLINE void call(const std::string& address, int port, const std::string& req, const std::string& auth, const std::string& proxy, bool ssl, const std::string& ssl_fingerprint, T&& cb, U&& close_cb, uv_loop_t* loop = nullptr, int timeout_seconds = 0)
{
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, timeout_seconds);
}
} // namespace JSONRPCRequest
+77 -67
View File
@@ -124,21 +124,32 @@ public:
, 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, "en_001");
std::setlocale(LC_ALL, "C");
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);
@@ -154,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();
@@ -188,72 +197,58 @@ public:
uv_cond_destroy(&m_cond);
uv_mutex_destroy(&m_mutex);
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) {
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) {
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
if (m_workerWaiting.load(std::memory_order_relaxed)) {
uv_cond_signal(&m_cond);
}
}
const std::string& log_file_path() const { return m_logFilePath; }
FORCEINLINE void schedule_reopen()
{
m_needReopen = true;
// 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()) {
@@ -274,7 +269,6 @@ private:
return true;
}
private:
static void run_wrapper(void* arg) { reinterpret_cast<Worker*>(arg)->run(); }
NOINLINE void run()
@@ -283,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
{
MutexLock lock(m_mutex);
if (m_readPos.load(std::memory_order_relaxed) == m_writePos.load(std::memory_order_acquire)) {
if (m_stopped) {
uv_mutex_unlock(&m_mutex);
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_mutex_unlock(&m_mutex);
bool expected = true;
if (m_needReopen.compare_exchange_strong(expected, false)) {
@@ -307,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]);
@@ -338,9 +332,11 @@ private:
strip_colors(p, size);
}
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);
}
@@ -360,30 +356,39 @@ 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
// 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) {
}
else if (errno == ENOENT) {
reopen(log_file_st);
}
}
}
fflush(stdout);
fflush(stderr);
@@ -430,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;
@@ -482,9 +492,6 @@ NOINLINE Writer::~Writer()
if (worker) {
worker->write(m_buf, size);
}
else {
fwrite(m_buf + 3, 1, size - 3, (m_buf[0] == 1) ? stdout : stderr);
}
#endif
}
@@ -503,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
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
+3 -3
View File
@@ -83,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];
@@ -278,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;
+14 -1
View File
@@ -65,6 +65,7 @@ void p2pool_usage()
"--rpc-port monerod RPC API port number, default is 18081\n"
"--zmq-port monerod ZMQ pub port number, default is 18083 (same port as in monerod's \"--zmq-pub\" command line parameter)\n"
"--stratum Comma-separated list of IP:port for stratum server to listen on\n"
"--nodejs-pool-rpc Comma-separated list of IP:port for daemon-compatible RPC facade for nodejs pools\n"
"--p2p Comma-separated list of IP:port for p2p server to listen on\n"
"--addpeers Comma-separated list of IP:port of other p2pool nodes to connect to\n"
"--stratum-ban-time N Number of seconds to ban misbehaving stratum client, default is %u\n"
@@ -72,6 +73,9 @@ void p2pool_usage()
"--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"
@@ -311,6 +315,8 @@ int main(int argc, char* argv[])
return 1;
}
p2pool::set_main_thread();
#if defined(_WIN32) && defined(_MSC_VER) && !defined(NDEBUG)
SymInitialize(GetCurrentProcess(), NULL, TRUE);
#endif
@@ -325,7 +331,7 @@ int main(int argc, char* argv[])
// 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
uv_default_loop();
p2pool::init_uv();
const p2pool::Params params = params_file.empty() ? get_params(argc, argv) : get_params(params_file);
@@ -337,7 +343,12 @@ int main(int argc, char* argv[])
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();
@@ -381,7 +392,9 @@ int main(int argc, char* argv[])
p2pool::indexed_hash::cleanup_storage();
#endif
if (params.m_consoleLogEnabled || params.m_logFileEnabled) {
p2pool::log::stop();
}
uv_loop_close(uv_default_loop());
+5
View File
@@ -50,6 +50,11 @@ public:
[[nodiscard]] virtual bool get_params(ChainParameters& out_params) const = 0;
virtual void on_external_block(const PoolBlock& block) = 0;
virtual 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) = 0;
virtual void submit_solution(const ChainParameters& chain_params, 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)
{
(void)chain_params;
submit_solution(coinbase_merkle_proof, hashing_blob, nonce_offset, seed_hash, blob, merkle_proof, merkle_proof_path);
}
virtual void print_status() const = 0;
virtual void api_status(log::Stream&) const = 0;
+18 -3
View File
@@ -28,6 +28,10 @@ LOG_CATEGORY(MergeMiningClientJSON_RPC)
namespace p2pool {
namespace {
static constexpr int MERGE_MINING_RPC_TIMEOUT_SECONDS = 30;
}
MergeMiningClientJSON_RPC::MergeMiningClientJSON_RPC(p2pool* pool, const std::string& host, const std::string& wallet)
: MergeMiningClientShared(pool, wallet)
, m_host(host)
@@ -135,7 +139,7 @@ void MergeMiningClientJSON_RPC::merge_mining_get_chain_id()
if (size > 0) {
LOGERR(1, "couldn't get merge mining id from " << m_host << ':' << m_port << ", error " << log::const_buf(data, size));
}
}, &m_loop);
}, &m_loop, MERGE_MINING_RPC_TIMEOUT_SECONDS);
}
bool MergeMiningClientJSON_RPC::parse_merge_mining_get_chain_id(const char* data, size_t size)
@@ -237,7 +241,7 @@ void MergeMiningClientJSON_RPC::merge_mining_get_aux_block(uint64_t height, cons
LOGERR(3, "couldn't get merge mining job from " << m_host << ':' << m_port << ", error " << log::const_buf(data, size));
}
m_getJobRunning = false;
}, &m_loop);
}, &m_loop, MERGE_MINING_RPC_TIMEOUT_SECONDS);
}
bool MergeMiningClientJSON_RPC::parse_merge_mining_get_aux_block(const char* data, size_t size, bool& changed)
@@ -313,7 +317,18 @@ void MergeMiningClientJSON_RPC::submit_solution(const std::vector<uint8_t>& /*co
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;
const ChainParameters chain_params = m_chainParams;
submit_solution_with_params(chain_params, aux_hash, aux_blob, seed_hash, blob, merkle_proof, merkle_proof_path);
}
void MergeMiningClientJSON_RPC::submit_solution(const ChainParameters& chain_params, 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)
{
submit_solution_with_params(chain_params, chain_params.aux_hash, chain_params.aux_blob, seed_hash, blob, merkle_proof, merkle_proof_path);
}
void MergeMiningClientJSON_RPC::submit_solution_with_params(const ChainParameters& /*chain_params*/, const hash& aux_hash, const std::vector<uint8_t>& aux_blob, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path)
{
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());
@@ -343,7 +358,7 @@ void MergeMiningClientJSON_RPC::submit_solution(const std::vector<uint8_t>& /*co
}
// Get new mining job
on_timer();
}, &m_loop);
}, &m_loop, MERGE_MINING_RPC_TIMEOUT_SECONDS);
}
void MergeMiningClientJSON_RPC::print_status() const
+2
View File
@@ -32,6 +32,7 @@ public:
bool get_params(ChainParameters& out_params) const 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 submit_solution(const ChainParameters& chain_params, 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;
@@ -51,6 +52,7 @@ private:
bool parse_merge_mining_get_aux_block(const char* data, size_t size, bool& changed);
bool parse_merge_mining_submit_solution(const char* data, size_t size) const;
void submit_solution_with_params(const ChainParameters& chain_params, const hash& aux_hash, const std::vector<uint8_t>& aux_blob, const hash& seed_hash, const std::vector<uint8_t>& blob, const std::vector<hash>& merkle_proof, uint32_t merkle_proof_path);
std::vector<uint8_t> m_previousAuxBlobs[NUM_PREVIOUS_HASHES];
+1 -1
View File
@@ -256,7 +256,7 @@ void Miner::run(WorkerData* data)
for (const AuxChainData& aux_data : j.m_auxChains) {
if (aux_data.difficulty.check_pow(h)) {
LOGINFO(0, log::Green() << "AUX BLOCK FOUND: chain_id " << aux_data.unique_id << ", diff " << aux_data.difficulty << ", worker thread " << data->m_index << '/' << data->m_count);
aux_blocks.emplace_back(p2pool::SubmitAuxBlockData{ aux_data.unique_id, j.m_templateId, j.m_nonce, j.m_extraNonce });
aux_blocks.emplace_back(p2pool::SubmitAuxBlockData{ aux_data.unique_id, j.m_templateId, j.m_nonce, j.m_extraNonce, {} });
}
}
+794
View File
@@ -0,0 +1,794 @@
/*
* 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/>.
*/
#include "common.h"
#include "nodejs_pool_rpc.h"
#include "block_template.h"
#include "keccak.h"
#include "p2pool.h"
#include "rapidjson_wrapper.h"
LOG_CATEGORY(NodejsPoolRpc)
namespace p2pool {
static constexpr int DEFAULT_BACKLOG = 64;
static constexpr size_t MAX_CACHED_WORK_ITEMS = 512;
static constexpr size_t NODEJS_POOL_RPC_CALLBACK_BUF_SIZE = 65536;
static constexpr size_t EXTERNAL_EXTRA_NONCE_SIZE = 4;
static constexpr uint32_t MIN_HASHING_BLOB_BATCH_COUNT = 128;
static thread_local const char* log_category_prefix = "NodejsPoolRpc ";
namespace {
FORCEINLINE void append_u64(std::vector<uint8_t>& buf, uint64_t value)
{
for (size_t i = 0; i < sizeof(value); ++i) {
buf.push_back(static_cast<uint8_t>(value >> (i * 8)));
}
}
FORCEINLINE void append_u32(std::vector<uint8_t>& buf, uint32_t value)
{
for (size_t i = 0; i < sizeof(value); ++i) {
buf.push_back(static_cast<uint8_t>(value >> (i * 8)));
}
}
FORCEINLINE uint32_t read_u32_le(const uint8_t* p)
{
return static_cast<uint32_t>(p[0])
| (static_cast<uint32_t>(p[1]) << 8)
| (static_cast<uint32_t>(p[2]) << 16)
| (static_cast<uint32_t>(p[3]) << 24);
}
bool compare_ignoring_ranges(const uint8_t* a, const uint8_t* b, size_t size, const std::initializer_list<std::pair<size_t, size_t>>& ignored_ranges)
{
for (size_t i = 0; i < size; ++i) {
bool ignored = false;
for (const auto& range : ignored_ranges) {
const size_t offset = range.first;
const size_t range_size = range.second;
if ((range_size > 0) && (offset <= i) && (i < offset + range_size)) {
ignored = true;
break;
}
}
if (!ignored && (a[i] != b[i])) {
return false;
}
}
return true;
}
std::string http_response(const std::string& body, const char* status = "200 OK", const char* content_type = "application/json")
{
std::string s;
s.reserve(body.size() + 128);
s += "HTTP/1.1 ";
s += status;
s += "\r\nContent-Type: ";
s += content_type;
s += "\r\nContent-Length: ";
s += std::to_string(body.size());
s += "\r\nConnection: close\r\n\r\n";
s += body;
return s;
}
bool parse_content_length(const std::string& headers, size_t& out)
{
const std::string lower = tolower(headers);
size_t k = lower.find("\r\ncontent-length:");
if (k == std::string::npos) {
if (lower.rfind("content-length:", 0) == 0) {
k = 0;
}
else {
out = 0;
return true;
}
}
k = lower.find(':', k);
if (k == std::string::npos) {
return false;
}
++k;
while ((k < headers.size()) && ((headers[k] == ' ') || (headers[k] == '\t'))) {
++k;
}
char* end = nullptr;
const unsigned long long value = strtoull(headers.c_str() + k, &end, 10);
if ((end == headers.c_str() + k) || (value > std::numeric_limits<size_t>::max())) {
return false;
}
out = static_cast<size_t>(value);
return true;
}
const char* jsonrpc_id_to_cstr(const rapidjson::Value& id, std::string& tmp)
{
if (id.IsString()) {
return id.GetString();
}
if (id.IsInt64()) {
tmp = std::to_string(id.GetInt64());
return tmp.c_str();
}
if (id.IsUint64()) {
tmp = std::to_string(id.GetUint64());
return tmp.c_str();
}
return "0";
}
bool extract_submitblock_request(const rapidjson::Value& params, std::vector<uint8_t>& blob, uint32_t& template_id, bool& has_template_id)
{
if (params.IsArray() && !params.Empty() && params[0].IsString()) {
has_template_id = false;
return from_hex(params[0].GetString(), params[0].GetStringLength(), blob);
}
if (params.IsArray() && !params.Empty() && params[0].IsObject()) {
const rapidjson::Value& req = params[0];
auto blob_it = req.FindMember("blob");
if ((blob_it == req.MemberEnd()) || !blob_it->value.IsString()) {
return false;
}
has_template_id = false;
auto template_it = req.FindMember("template_id");
if (template_it != req.MemberEnd()) {
if (template_it->value.IsUint()) {
template_id = template_it->value.GetUint();
has_template_id = true;
}
else if (template_it->value.IsUint64() && (template_it->value.GetUint64() <= std::numeric_limits<uint32_t>::max())) {
template_id = static_cast<uint32_t>(template_it->value.GetUint64());
has_template_id = true;
}
else if (template_it->value.IsInt64() && (template_it->value.GetInt64() >= 0) && (template_it->value.GetInt64() <= std::numeric_limits<uint32_t>::max())) {
template_id = static_cast<uint32_t>(template_it->value.GetInt64());
has_template_id = true;
}
else {
return false;
}
}
return from_hex(blob_it->value.GetString(), blob_it->value.GetStringLength(), blob);
}
return false;
}
uint32_t get_requested_hashing_blob_batch_count(const rapidjson::Value& params)
{
if (!params.IsObject()) {
return MIN_HASHING_BLOB_BATCH_COUNT;
}
auto it = params.FindMember("expected_workers");
if (it == params.MemberEnd()) {
return MIN_HASHING_BLOB_BATCH_COUNT;
}
uint64_t expected_workers = 0;
if (it->value.IsUint64()) {
expected_workers = it->value.GetUint64();
}
else if (it->value.IsInt64() && (it->value.GetInt64() > 0)) {
expected_workers = static_cast<uint64_t>(it->value.GetInt64());
}
else {
return MIN_HASHING_BLOB_BATCH_COUNT;
}
const uint64_t scaled = (expected_workers * 13ULL + 9ULL) / 10ULL;
const uint64_t batch_count = std::max<uint64_t>(MIN_HASHING_BLOB_BATCH_COUNT, scaled);
return (batch_count > std::numeric_limits<uint32_t>::max()) ? std::numeric_limits<uint32_t>::max() : static_cast<uint32_t>(batch_count);
}
} // namespace
NodejsPoolRpc::NodejsPoolRpc(p2pool* pool, const std::string& listen_addresses)
: TCPServer(DEFAULT_BACKLOG, RpcClient::allocate, std::string(), Params::ProxyType::INVALID)
, m_pool(pool)
{
m_callbackBuf.resize(NODEJS_POOL_RPC_CALLBACK_BUF_SIZE);
uv_mutex_init_checked(&m_recentWorkLock);
start_listening(listen_addresses, false);
if (m_listenPort < 0) {
LOGERR(1, "failed to listen on nodejs pool rpc facade");
throw std::exception();
}
}
NodejsPoolRpc::~NodejsPoolRpc()
{
shutdown_tcp();
uv_mutex_destroy(&m_recentWorkLock);
}
void NodejsPoolRpc::on_shutdown()
{
}
const char* NodejsPoolRpc::get_log_category() const
{
return log_category_prefix;
}
void NodejsPoolRpc::remember_work_snapshot(const WorkSnapshot& work) const
{
if (!work.ready) {
return;
}
WorkSnapshot cached = work;
MutexLock lock(m_recentWorkLock);
auto same_template = [&cached](const WorkSnapshot& item) {
return (item.template_id == cached.template_id)
&& (item.work_hash == cached.work_hash)
&& (item.sidechain_height == cached.sidechain_height);
};
for (size_t i = 0; i < m_recentWork.size(); ++i) {
if (same_template(m_recentWork[i])) {
m_recentWork.erase(m_recentWork.begin() + i);
break;
}
}
m_recentWork.insert(m_recentWork.begin(), std::move(cached));
if (m_recentWork.size() > MAX_CACHED_WORK_ITEMS) {
m_recentWork.resize(MAX_CACHED_WORK_ITEMS);
}
}
bool NodejsPoolRpc::find_cached_work_by_block_blob(const std::vector<uint8_t>& blob, WorkSnapshot& out) const
{
MutexLock lock(m_recentWorkLock);
for (const WorkSnapshot& work : m_recentWork) {
if (!work.ready || (work.block_template_blob.size() != blob.size())) {
continue;
}
if ((work.nonce_offset + NONCE_SIZE > blob.size()) || (work.extra_nonce_offset + work.extra_nonce_size > blob.size())) {
continue;
}
if (!compare_ignoring_ranges(
blob.data(),
work.block_template_blob.data(),
blob.size(),
{
{ work.nonce_offset, NONCE_SIZE },
{ work.extra_nonce_offset, work.extra_nonce_size }
}))
{
continue;
}
out = work;
return true;
}
return false;
}
bool NodejsPoolRpc::find_cached_work_by_template_id(uint32_t template_id, WorkSnapshot& out) const
{
MutexLock lock(m_recentWorkLock);
for (const WorkSnapshot& work : m_recentWork) {
if (!work.ready) {
continue;
}
if (work.template_id == template_id) {
out = work;
return true;
}
}
return false;
}
uint32_t NodejsPoolRpc::copy_cached_hashing_blob(const WorkSnapshot& work, uint32_t extra_nonce, uint8_t (&blob)[128], size_t& nonce_offset) const
{
if (!work.hashing_blob_size || !work.hashing_blob_count || work.hashing_blobs.empty()) {
return 0;
}
if (extra_nonce < work.hashing_blob_extra_nonce_start) {
return 0;
}
const uint32_t index = extra_nonce - work.hashing_blob_extra_nonce_start;
if (index >= work.hashing_blob_count) {
return 0;
}
const size_t blob_size = work.hashing_blob_size;
const size_t offset = static_cast<size_t>(index) * blob_size;
if ((blob_size > sizeof(blob)) || (offset + blob_size > work.hashing_blobs.size())) {
return 0;
}
memcpy(blob, work.hashing_blobs.data() + offset, blob_size);
nonce_offset = work.hashing_nonce_offset;
return static_cast<uint32_t>(blob_size);
}
bool NodejsPoolRpc::make_work_snapshot(WorkSnapshot& out, uint32_t hashing_blob_batch_count) const
{
const MinerData miner_data = m_pool->miner_data();
if (!miner_data.height || miner_data.prev_id.empty()) {
return false;
}
uint8_t hashing_blob[128] = {};
uint64_t mining_height = 0;
uint64_t sidechain_height = 0;
difficulty_type mainchain_diff, aux_diff, sidechain_diff;
hash seed_hash;
size_t nonce_offset = 0;
uint32_t template_id = 0;
const uint32_t hashing_blob_size = m_pool->block_template().get_hashing_blob(0, hashing_blob, mining_height, sidechain_height, mainchain_diff, aux_diff, sidechain_diff, seed_hash, nonce_offset, template_id);
if (!hashing_blob_size) {
return false;
}
size_t full_nonce_offset = 0;
size_t extra_nonce_offset = 0;
size_t merkle_root_offset = 0;
hash merge_mining_root;
const BlockTemplate* block_tpl = nullptr;
std::vector<uint8_t> block_template_blob = m_pool->block_template().get_block_template_blob(template_id, 0, full_nonce_offset, extra_nonce_offset, merkle_root_offset, merge_mining_root, &block_tpl);
if (block_template_blob.empty()) {
return false;
}
if (merkle_root_offset && (merkle_root_offset + HASH_SIZE <= block_template_blob.size())) {
memcpy(block_template_blob.data() + merkle_root_offset, merge_mining_root.h, HASH_SIZE);
}
out.ready = true;
out.mainchain_height = miner_data.height - 1;
out.mining_height = mining_height;
out.sidechain_height = sidechain_height;
out.parent_prev_id = miner_data.prev_id;
out.seed_hash = seed_hash;
out.work_hash = {};
out.template_id = template_id;
out.nonce_offset = full_nonce_offset;
out.hashing_nonce_offset = nonce_offset;
out.extra_nonce_offset = extra_nonce_offset;
out.extra_nonce_size = EXTERNAL_EXTRA_NONCE_SIZE;
out.hashing_blob_extra_nonce_start = 1;
out.mainchain_difficulty = mainchain_diff;
out.sidechain_difficulty = sidechain_diff;
out.aux_difficulty = aux_diff;
out.submit_difficulty = aux_diff.empty() ? sidechain_diff : aux_diff;
out.block_template_blob = std::move(block_template_blob);
out.hashing_blob.assign(hashing_blob, hashing_blob + hashing_blob_size);
out.aux_chains = m_pool->block_template().get_aux_chains(template_id);
out.aux_chain_params.clear();
out.aux_chain_params.reserve(out.aux_chains.size());
for (const AuxChainData& aux_data : out.aux_chains) {
IMergeMiningClient::ChainParameters chain_params;
if (m_pool->get_merge_mining_chain_params(aux_data.unique_id, chain_params) && (chain_params.aux_hash == aux_data.data) && !chain_params.aux_blob.empty()) {
out.aux_chain_params.push_back(std::move(chain_params));
}
}
uint64_t batch_height = 0;
difficulty_type batch_mainchain_diff, batch_aux_diff, batch_sidechain_diff;
hash batch_seed_hash;
size_t batch_nonce_offset = 0;
uint8_t batch_blob[128] = {};
out.hashing_blob_size = 0;
out.hashing_blobs.clear();
out.hashing_blobs.reserve(static_cast<size_t>(hashing_blob_batch_count) * sizeof(batch_blob));
for (uint32_t i = 0; i < hashing_blob_batch_count; ++i) {
const uint32_t current_extra_nonce = out.hashing_blob_extra_nonce_start + i;
const uint32_t current_blob_size = m_pool->block_template().get_hashing_blob(
template_id,
current_extra_nonce,
batch_blob,
batch_height,
batch_mainchain_diff,
batch_aux_diff,
batch_sidechain_diff,
batch_seed_hash,
batch_nonce_offset);
if (!current_blob_size) {
break;
}
if (i == 0) {
out.hashing_blob_size = current_blob_size;
}
else if (current_blob_size != out.hashing_blob_size) {
return false;
}
if ((batch_nonce_offset != nonce_offset) || (batch_seed_hash != seed_hash)) {
return false;
}
out.hashing_blobs.insert(out.hashing_blobs.end(), batch_blob, batch_blob + current_blob_size);
++out.hashing_blob_count;
}
if (!out.hashing_blob_size || !out.hashing_blob_count) {
return false;
}
std::vector<uint8_t> work_key;
work_key.reserve(HASH_SIZE * 2 + sizeof(uint64_t) * 4 + sizeof(uint32_t) + out.hashing_blob.size());
work_key.insert(work_key.end(), miner_data.prev_id.h, miner_data.prev_id.h + HASH_SIZE);
work_key.insert(work_key.end(), seed_hash.h, seed_hash.h + HASH_SIZE);
append_u64(work_key, mining_height);
append_u64(work_key, sidechain_height);
append_u64(work_key, out.submit_difficulty.lo);
append_u64(work_key, out.submit_difficulty.hi);
append_u32(work_key, template_id);
work_key.insert(work_key.end(), out.hashing_blob.begin(), out.hashing_blob.end());
keccak(work_key.data(), static_cast<int>(work_key.size()), out.work_hash.h);
remember_work_snapshot(out);
return true;
}
bool NodejsPoolRpc::RpcClient::on_read(const char* data, uint32_t size)
{
m_request.append(data, size);
return static_cast<NodejsPoolRpc*>(m_owner)->handle_http_request(this);
}
bool NodejsPoolRpc::handle_http_request(RpcClient* client)
{
std::string& request = client->m_request;
const size_t headers_end = request.find("\r\n\r\n");
if (headers_end == std::string::npos) {
return true;
}
size_t content_length = 0;
if (!parse_content_length(request.substr(0, headers_end), content_length)) {
const std::string response = http_response("{\"error\":\"invalid content-length\"}", "400 Bad Request");
const bool sent = send(client, [&response](uint8_t* buf, size_t buf_size) {
const size_t n = std::min(buf_size, response.size());
memcpy(buf, response.data(), n);
return n;
}, true);
(void)sent;
client->close();
return true;
}
const size_t request_size = headers_end + 4 + content_length;
if (request.size() < request_size) {
return true;
}
const size_t line_end = request.find("\r\n");
if (line_end == std::string::npos) {
return true;
}
const std::string first_line = request.substr(0, line_end);
const size_t s1 = first_line.find(' ');
const size_t s2 = (s1 == std::string::npos) ? std::string::npos : first_line.find(' ', s1 + 1);
if ((s1 == std::string::npos) || (s2 == std::string::npos)) {
const std::string response = http_response("{\"error\":\"invalid request line\"}", "400 Bad Request");
const bool sent = send(client, [&response](uint8_t* buf, size_t buf_size) {
const size_t n = std::min(buf_size, response.size());
memcpy(buf, response.data(), n);
return n;
}, true);
(void)sent;
client->close();
return true;
}
const std::string method = first_line.substr(0, s1);
const std::string path = first_line.substr(s1 + 1, s2 - s1 - 1);
const std::string body = request.substr(headers_end + 4, content_length);
request.clear();
LOGINFO(4, "http request: method=" << method << ", path=" << path << ", content_length=" << content_length);
std::string response;
if ((method == "GET") && (path == "/get_height")) {
response = http_response(build_get_height_response());
}
else if ((method == "POST") && (path == "/json_rpc")) {
response = http_response(build_json_rpc_response(body));
}
else {
response = http_response("{\"error\":\"not found\"}", "404 Not Found");
}
const bool sent = send(client, [&response](uint8_t* buf, size_t buf_size) {
const size_t n = std::min(buf_size, response.size());
memcpy(buf, response.data(), n);
return n;
}, true);
(void)sent;
client->close();
return true;
}
std::string NodejsPoolRpc::build_get_height_response() const
{
WorkSnapshot work;
if (!make_work_snapshot(work, MIN_HASHING_BLOB_BATCH_COUNT)) {
return "{\"status\":\"BUSY\"}";
}
char body[512] = {};
log::Stream s(body);
s << "{\"height\":" << work.mainchain_height
<< ",\"hash\":\"" << work.work_hash << '"'
<< ",\"status\":\"OK\""
<< ",\"untrusted\":false}";
return std::string(body, s.m_pos);
}
std::string NodejsPoolRpc::json_error_response(const char* id, int code, const std::string& message) const
{
char body[1024] = {};
log::Stream s(body);
s << "{\"id\":\"" << log::EscapedString(id)
<< "\",\"jsonrpc\":\"2.0\",\"error\":{\"code\":" << code
<< ",\"message\":\"" << log::EscapedString(message) << "\"}}";
return std::string(body, s.m_pos);
}
std::string NodejsPoolRpc::build_json_rpc_response(const std::string& body) const
{
rapidjson::Document doc;
doc.Parse(body.c_str(), body.size());
if (doc.HasParseError() || !doc.IsObject()) {
return json_error_response("0", -32700, "parse error");
}
std::string id_buf;
const char* id = "0";
if (doc.HasMember("id")) {
id = jsonrpc_id_to_cstr(doc["id"], id_buf);
}
auto method_it = doc.FindMember("method");
if ((method_it == doc.MemberEnd()) || !method_it->value.IsString()) {
return json_error_response(id, -32600, "invalid request");
}
const std::string method = method_it->value.GetString();
LOGINFO(4, "json_rpc method=" << method);
if (method == "getlastblockheader") {
WorkSnapshot work;
if (!make_work_snapshot(work, MIN_HASHING_BLOB_BATCH_COUNT)) {
return json_error_response(id, 0, "not_ready");
}
char response[1024] = {};
log::Stream s(response);
s << "{\"id\":\"" << log::EscapedString(id)
<< "\",\"jsonrpc\":\"2.0\",\"result\":{\"status\":\"OK\",\"block_header\":{\"hash\":\""
<< work.work_hash << "\",\"height\":" << work.mainchain_height << "}}}";
return std::string(response, s.m_pos);
}
if (method == "getblocktemplate") {
WorkSnapshot work;
const uint32_t hashing_blob_batch_count = (doc.HasMember("params") ? get_requested_hashing_blob_batch_count(doc["params"]) : MIN_HASHING_BLOB_BATCH_COUNT);
if (!make_work_snapshot(work, hashing_blob_batch_count)) {
return json_error_response(id, 0, "not_ready");
}
const size_t response_capacity =
2048 +
(work.block_template_blob.size() * 2) +
(work.hashing_blob.size() * 2) +
(work.hashing_blobs.size() * 2) +
256;
std::vector<char> response(response_capacity, '\0');
log::Stream s(response.data(), response.size());
s << "{\"id\":\"" << log::EscapedString(id) << "\",\"jsonrpc\":\"2.0\",\"result\":{"
<< "\"blocktemplate_blob\":\"" << log::hex_buf(work.block_template_blob.data(), work.block_template_blob.size()) << '"'
<< ",\"blockhashing_blob\":\"" << log::hex_buf(work.hashing_blob.data(), work.hashing_blob.size()) << '"'
<< ",\"p2pool_hashing_blob_batch_start\":" << work.hashing_blob_extra_nonce_start
<< ",\"p2pool_hashing_blob_batch_size\":" << work.hashing_blob_size
<< ",\"p2pool_hashing_blob_batch_count\":" << work.hashing_blob_count
<< ",\"p2pool_hashing_blob_batch\":\"" << log::hex_buf(work.hashing_blobs.data(), work.hashing_blobs.size()) << '"'
<< ",\"difficulty\":" << work.submit_difficulty.lo
<< ",\"height\":" << work.mining_height
<< ",\"nonce_offset\":" << work.nonce_offset
<< ",\"hashing_nonce_offset\":" << work.hashing_nonce_offset
<< ",\"reserved_offset\":" << work.extra_nonce_offset
<< ",\"seed_hash\":\"" << work.seed_hash << '"'
<< ",\"status\":\"OK\""
<< ",\"template_id\":" << work.template_id
<< ",\"sidechain_height\":" << work.sidechain_height
<< ",\"aux_difficulty\":\"" << work.aux_difficulty << '"'
<< ",\"sidechain_difficulty\":\"" << work.sidechain_difficulty << '"'
<< ",\"mainchain_difficulty\":\"" << work.mainchain_difficulty << '"'
<< ",\"backend_submit_difficulty\":\"" << work.submit_difficulty << '"'
<< ",\"backend_mode\":\"aux_only\""
<< ",\"p2pool_external_extra_nonce\":true"
<< ",\"p2pool_external_extra_nonce_size\":" << work.extra_nonce_size
<< ",\"p2pool_external_extra_nonce_endianness\":\"LE\""
<< "}}";
return std::string(response.data(), s.m_pos);
}
if ((method == "submitblock") || (method == "submit_block")) {
auto params_it = doc.FindMember("params");
if (params_it == doc.MemberEnd()) {
return json_error_response(id, -32602, "missing params");
}
std::vector<uint8_t> blob;
uint32_t requested_template_id = 0;
bool has_requested_template_id = false;
if (!extract_submitblock_request(params_it->value, blob, requested_template_id, has_requested_template_id) || blob.empty()) {
return json_error_response(id, -32602, "invalid blob");
}
WorkSnapshot work;
const bool found_work = has_requested_template_id
? find_cached_work_by_template_id(requested_template_id, work)
: find_cached_work_by_block_blob(blob, work);
if (!found_work) {
return json_error_response(id, 0, "unknown_or_stale_template");
}
if (work.nonce_offset + NONCE_SIZE > blob.size()) {
return json_error_response(id, 0, "invalid_nonce_offset");
}
const uint32_t nonce = read_u32_le(blob.data() + work.nonce_offset);
if (work.extra_nonce_offset + work.extra_nonce_size > blob.size()) {
return json_error_response(id, 0, "invalid_extra_nonce_offset");
}
const uint32_t extra_nonce = read_u32_le(blob.data() + work.extra_nonce_offset);
uint8_t hashing_blob[128] = {};
uint64_t height = work.mining_height;
difficulty_type mainchain_diff = work.mainchain_difficulty;
difficulty_type aux_diff = work.aux_difficulty;
difficulty_type sidechain_diff = work.sidechain_difficulty;
hash seed_hash = work.seed_hash;
size_t nonce_offset = 0;
uint32_t hashing_blob_size = copy_cached_hashing_blob(work, extra_nonce, hashing_blob, nonce_offset);
if (!hashing_blob_size) {
hashing_blob_size = m_pool->block_template().get_hashing_blob(work.template_id, extra_nonce, hashing_blob, height, mainchain_diff, aux_diff, sidechain_diff, seed_hash, nonce_offset);
}
if (!hashing_blob_size || (nonce_offset + NONCE_SIZE > hashing_blob_size)) {
return json_error_response(id, 0, "stale_template");
}
memcpy(hashing_blob + nonce_offset, blob.data() + work.nonce_offset, NONCE_SIZE);
hash result_hash;
if (!m_pool->calculate_hash(hashing_blob, hashing_blob_size, height, seed_hash, result_hash, false)) {
return json_error_response(id, 0, "pow_check_failed");
}
if (!work.submit_difficulty.check_pow(result_hash)) {
return json_error_response(id, 0, "low_diff");
}
const bool meets_mainchain = mainchain_diff.check_pow(result_hash);
const bool meets_aux = aux_diff.check_pow(result_hash);
const bool meets_sidechain = sidechain_diff.check_pow(result_hash);
LOGINFO(4, "NodejsPoolRpc submitblock: template id = " << work.template_id
<< ", nonce = " << nonce
<< ", extra_nonce = " << extra_nonce
<< ", backend_submit_diff = " << work.submit_difficulty
<< ", aux_diff = " << aux_diff
<< ", sidechain_diff = " << sidechain_diff
<< ", mainchain_diff = " << mainchain_diff
<< ", meets_aux = " << (meets_aux ? "true" : "false")
<< ", meets_sidechain = " << (meets_sidechain ? "true" : "false")
<< ", meets_mainchain = " << (meets_mainchain ? "true" : "false"));
bool parent_submitted = false;
bool sidechain_submitted = false;
size_t aux_submitted = 0;
if (meets_mainchain) {
m_pool->submit_block_async(std::move(blob));
parent_submitted = true;
}
if (meets_aux) {
std::vector<p2pool::SubmitAuxBlockData> aux_blocks;
aux_blocks.reserve(work.aux_chains.size());
for (const AuxChainData& aux_data : work.aux_chains) {
if (aux_data.difficulty.check_pow(result_hash)) {
auto params_it = std::find_if(work.aux_chain_params.begin(), work.aux_chain_params.end(),
[&aux_data](const IMergeMiningClient::ChainParameters& params) {
return (params.aux_id == aux_data.unique_id) && (params.aux_hash == aux_data.data);
});
if (params_it == work.aux_chain_params.end()) {
LOGWARN(3, "NodejsPoolRpc submitblock: missing cached aux params for chain_id = " << aux_data.unique_id
<< ", aux_hash = " << aux_data.data);
continue;
}
aux_blocks.emplace_back(p2pool::SubmitAuxBlockData{ aux_data.unique_id, work.template_id, nonce, extra_nonce, *params_it });
}
}
aux_submitted = aux_blocks.size();
if (!aux_blocks.empty()) {
m_pool->submit_aux_block_async(aux_blocks);
}
}
if (meets_sidechain) {
sidechain_submitted = m_pool->submit_sidechain_block(work.template_id, nonce, extra_nonce);
}
char response[2048] = {};
log::Stream s(response, sizeof(response));
s << "{\"id\":\"" << log::EscapedString(id) << "\",\"jsonrpc\":\"2.0\",\"result\":{"
<< "\"status\":\"OK\""
<< ",\"accepted\":true"
<< ",\"backend_mode\":\"aux_only\""
<< ",\"aux_accepted\":" << ((aux_submitted > 0) ? "true" : "false")
<< ",\"aux_submitted\":" << aux_submitted
<< ",\"sidechain_accepted\":" << (sidechain_submitted ? "true" : "false")
<< ",\"parent_submitted\":" << (parent_submitted ? "true" : "false")
<< ",\"template_id\":" << work.template_id
<< ",\"submit_difficulty\":\"" << work.submit_difficulty << '"'
<< "}}";
return std::string(response, s.m_pos);
}
return json_error_response(id, -32601, "method not found");
}
} // namespace p2pool
+102
View File
@@ -0,0 +1,102 @@
/*
* 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/>.
*/
#pragma once
#include "tcp_server.h"
#include "merge_mining_client.h"
namespace p2pool {
class p2pool;
class NodejsPoolRpc : public TCPServer
{
public:
NodejsPoolRpc(p2pool* pool, const std::string& listen_addresses);
~NodejsPoolRpc() override;
void on_shutdown() override;
private:
struct WorkSnapshot
{
bool ready = false;
uint64_t mainchain_height = 0;
uint64_t mining_height = 0;
uint64_t sidechain_height = 0;
hash parent_prev_id;
hash seed_hash;
hash work_hash;
uint32_t template_id = 0;
size_t nonce_offset = 0;
size_t hashing_nonce_offset = 0;
size_t extra_nonce_offset = 0;
size_t extra_nonce_size = 4;
uint32_t hashing_blob_extra_nonce_start = 0;
uint32_t hashing_blob_count = 0;
uint32_t hashing_blob_size = 0;
difficulty_type mainchain_difficulty;
difficulty_type sidechain_difficulty;
difficulty_type aux_difficulty;
difficulty_type submit_difficulty;
std::vector<uint8_t> block_template_blob;
std::vector<uint8_t> hashing_blob;
std::vector<uint8_t> hashing_blobs;
std::vector<AuxChainData> aux_chains;
std::vector<IMergeMiningClient::ChainParameters> aux_chain_params;
};
struct RpcClient : public Client
{
RpcClient() : Client(m_readBuf, sizeof(m_readBuf)) {}
static Client* allocate() { return new RpcClient(); }
size_t size() const override { return sizeof(RpcClient); }
void reset() override
{
Client::reset();
m_request.clear();
m_request.shrink_to_fit();
}
bool on_connect() override { return true; }
bool on_read(const char* data, uint32_t size) override;
alignas(8) char m_readBuf[16384] = {};
std::string m_request;
};
p2pool* m_pool;
mutable uv_mutex_t m_recentWorkLock;
mutable std::vector<WorkSnapshot> m_recentWork;
const char* get_log_category() const override;
bool make_work_snapshot(WorkSnapshot& out, uint32_t hashing_blob_batch_count) const;
void remember_work_snapshot(const WorkSnapshot& work) const;
bool find_cached_work_by_template_id(uint32_t template_id, WorkSnapshot& out) const;
bool find_cached_work_by_block_blob(const std::vector<uint8_t>& blob, WorkSnapshot& out) const;
uint32_t copy_cached_hashing_blob(const WorkSnapshot& work, uint32_t extra_nonce, uint8_t (&blob)[128], size_t& nonce_offset) const;
bool handle_http_request(RpcClient* client);
std::string build_get_height_response() const;
std::string build_json_rpc_response(const std::string& body) const;
std::string json_error_response(const char* id, int code, const std::string& message) const;
};
} // namespace p2pool
+58 -9
View File
@@ -66,6 +66,8 @@ static constexpr hash seed_onion_nodes[] = {
};
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")
};
@@ -895,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,
@@ -2210,6 +2216,14 @@ bool P2PServer::P2PClient::on_read(const char* data, uint32_t size)
if (bytes_left >= 1 + sizeof(uint32_t)) {
const uint32_t block_size = read_unaligned(reinterpret_cast<uint32_t*>(buf + 1));
if (block_size > MAX_BLOCK_SIZE) {
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent too big BLOCK_RESPONSE");
ban(DEFAULT_BAN_TIME);
server->remove_peer_from_list(this);
return false;
}
if (bytes_left >= 1 + sizeof(uint32_t) + block_size) {
bytes_read = 1 + sizeof(uint32_t) + block_size;
@@ -2233,6 +2247,14 @@ bool P2PServer::P2PClient::on_read(const char* data, uint32_t size)
if (bytes_left >= 1 + sizeof(uint32_t)) {
const uint32_t block_size = read_unaligned(reinterpret_cast<uint32_t*>(buf + 1));
if (block_size > MAX_BLOCK_SIZE) {
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent too big " << (compact ? "BLOCK_BROADCAST_COMPACT" : "BLOCK_BROADCAST"));
ban(DEFAULT_BAN_TIME);
server->remove_peer_from_list(this);
return false;
}
if (bytes_left >= 1 + sizeof(uint32_t) + block_size) {
bytes_read = 1 + sizeof(uint32_t) + block_size;
if (!on_block_broadcast(buf + 1 + sizeof(uint32_t), block_size, compact)) {
@@ -2303,6 +2325,14 @@ bool P2PServer::P2PClient::on_read(const char* data, uint32_t size)
if (bytes_left >= 1 + sizeof(uint32_t)) {
const uint32_t msg_size = read_unaligned(reinterpret_cast<uint32_t*>(buf + 1));
if (msg_size > MAX_BLOCK_SIZE) {
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent too big AUX_JOB_DONATION");
ban(DEFAULT_BAN_TIME);
server->remove_peer_from_list(this);
return false;
}
if (bytes_left >= 1 + sizeof(uint32_t) + msg_size) {
bytes_read = 1 + sizeof(uint32_t) + msg_size;
@@ -2320,6 +2350,14 @@ bool P2PServer::P2PClient::on_read(const char* data, uint32_t size)
if (bytes_left >= 1 + sizeof(uint32_t)) {
const uint32_t msg_size = read_unaligned(reinterpret_cast<uint32_t*>(buf + 1));
if (msg_size > MAX_BLOCK_SIZE) {
LOGWARN(4, "peer " << static_cast<char*>(m_addrString) << " sent too big MONERO_BLOCK_BROADCAST");
ban(DEFAULT_BAN_TIME);
server->remove_peer_from_list(this);
return false;
}
if (bytes_left >= 1 + sizeof(uint32_t) + msg_size) {
bytes_read = 1 + sizeof(uint32_t) + msg_size;
@@ -2402,12 +2440,11 @@ bool P2PServer::P2PClient::send_handshake_challenge()
bool is_tor = false;
if ((m_addressType == AddressType::DomainName) && (strstr(m_addrString, ".onion:"))) {
// We're connecting to an .onion address
is_tor = true;
}
else if (!owner->m_pool->params().m_onionPubkey.empty() && m_isIncoming && (m_addressType != AddressType::DomainName) && m_addr.is_localhost()) {
// We published our .onion address, and it's an incoming connection on localhost interface, so it's likely an incoming tor connection
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;
}
@@ -3032,7 +3069,8 @@ void P2PServer::P2PClient::on_peer_list_response(const uint8_t* buf)
m_protocolVersion = PROTOCOL_VERSION_1_0;
}
else {
m_protocolVersion = std::min(version, SUPPORTED_PROTOCOL_VERSION);
// Don't allow version downgrades
m_protocolVersion = std::max(m_protocolVersion, std::min(version, SUPPORTED_PROTOCOL_VERSION));
}
m_SoftwareVersion = *reinterpret_cast<uint32_t*>(ip.data + 4);
@@ -3104,11 +3142,19 @@ void P2PServer::P2PClient::on_block_notify(const uint8_t* buf)
return;
}
if (!server->m_blockNotifyRequests.insert(*id.u64()).second || !server->m_missingBlockRequests.emplace(m_peerId, *id.u64()).second) {
const uint64_t id64 = *id.u64();
// First check these two, then update them only after a successful send
if (server->m_blockNotifyRequests.find(id64) != server->m_blockNotifyRequests.end()) {
LOGINFO(6, "BLOCK_REQUEST for id = " << id << " was already sent");
return;
}
if (server->m_missingBlockRequests.find(std::make_pair(m_peerId, id64)) != server->m_missingBlockRequests.end()) {
LOGINFO(6, "BLOCK_REQUEST for id = " << id << " was already sent to this peer");
return;
}
const bool result = server->send(this,
[&id, this](uint8_t* buf, size_t buf_size) -> size_t
{
@@ -3129,7 +3175,10 @@ void P2PServer::P2PClient::on_block_notify(const uint8_t* buf)
});
if (result) {
m_blockPendingRequests.push_back(*id.u64());
server->m_blockNotifyRequests.insert(id64);
server->m_missingBlockRequests.emplace(m_peerId, id64);
m_blockPendingRequests.push_back(id64);
}
}
}
+84 -5
View File
@@ -29,6 +29,7 @@
#include "side_chain.h"
#include "stratum_server.h"
#include "p2p_server.h"
#include "nodejs_pool_rpc.h"
#if defined(WITH_RANDOMX) && !defined(P2POOL_UNIT_TESTS)
#include "miner.h"
#endif
@@ -171,6 +172,7 @@ p2pool::p2pool(const Params& params)
uv_mutex_init_checked(&m_submitBlockDataLock);
uv_mutex_init_checked(&m_submitAuxBlockDataLock);
uv_mutex_init_checked(&m_recentAuxSubmitsLock);
uv_mutex_init_checked(&m_missingHeightsLock);
@@ -255,6 +257,7 @@ p2pool::~p2pool()
uv_mutex_destroy(&m_submitBlockDataLock);
uv_mutex_destroy(&m_submitAuxBlockDataLock);
uv_mutex_destroy(&m_recentAuxSubmitsLock);
uv_mutex_destroy(&m_missingHeightsLock);
@@ -274,6 +277,8 @@ p2pool::~p2pool()
PoolBlock::s_precalculatedSharesLock = nullptr;
delete p;
}
delete m_nodejsPoolRpc;
}
void p2pool::update_host_ping(const std::string& display_name, double ping)
@@ -653,6 +658,21 @@ void p2pool::set_aux_job_donation(const std::vector<IMergeMiningClient::ChainPar
}
#endif
bool p2pool::get_merge_mining_chain_params(const hash& chain_id, IMergeMiningClient::ChainParameters& out_params) const
{
ReadLock lock(m_mergeMiningClientsLock);
IMergeMiningClient::ChainParameters chain_params;
for (const IMergeMiningClient* c : m_mergeMiningClients) {
if (c->get_params(chain_params) && (chain_params.aux_id == chain_id)) {
out_params = chain_params;
return true;
}
}
return false;
}
void p2pool::update_aux_data(const hash& chain_id)
{
if (m_stopped) {
@@ -903,9 +923,28 @@ void p2pool::submit_block_async(std::vector<uint8_t>&& blob)
void p2pool::submit_aux_block_async(const std::vector<SubmitAuxBlockData>& aux_blocks)
{
std::vector<SubmitAuxBlockData> filtered_aux_blocks;
filtered_aux_blocks.reserve(aux_blocks.size());
for (const SubmitAuxBlockData& aux_block : aux_blocks) {
if (remember_recent_aux_submit(aux_block)) {
filtered_aux_blocks.push_back(aux_block);
}
else {
LOGINFO(4, "submit_aux_block_async: skipping duplicate aux submit for template id = " << aux_block.template_id
<< ", chain_id = " << aux_block.chain_id
<< ", nonce = " << aux_block.nonce
<< ", extra_nonce = " << aux_block.extra_nonce);
}
}
if (filtered_aux_blocks.empty()) {
return;
}
{
MutexLock lock(m_submitAuxBlockDataLock);
m_submitAuxBlockData.insert(m_submitAuxBlockData.end(), aux_blocks.begin(), aux_blocks.end());
m_submitAuxBlockData.insert(m_submitAuxBlockData.end(), filtered_aux_blocks.begin(), filtered_aux_blocks.end());
}
// If p2pool is stopped, m_submitAuxBlockAsync is most likely already closed
@@ -921,6 +960,36 @@ void p2pool::submit_aux_block_async(const std::vector<SubmitAuxBlockData>& aux_b
}
}
bool p2pool::remember_recent_aux_submit(const SubmitAuxBlockData& data) const
{
// Collapse burst duplicates from overlapping workers, but keep the window short
// so a later retry after a genuine transport failure can still go through.
constexpr uint64_t DUPLICATE_WINDOW = 5;
const uint64_t now = seconds_since_epoch();
MutexLock lock(m_recentAuxSubmitsLock);
m_recentAuxSubmits.erase(
std::remove_if(m_recentAuxSubmits.begin(), m_recentAuxSubmits.end(),
[now](const RecentAuxSubmit& item) {
return (now > item.timestamp) && (now - item.timestamp > DUPLICATE_WINDOW);
}),
m_recentAuxSubmits.end());
for (const RecentAuxSubmit& item : m_recentAuxSubmits) {
if ((item.chain_id == data.chain_id)
&& (item.template_id == data.template_id)
&& (item.nonce == data.nonce)
&& (item.extra_nonce == data.extra_nonce)
&& (data.chain_params.aux_hash.empty() || item.aux_hash.empty() || (item.aux_hash == data.chain_params.aux_hash))) {
return false;
}
}
m_recentAuxSubmits.push_back(RecentAuxSubmit{ data.chain_id, data.chain_params.aux_hash, data.template_id, data.nonce, data.extra_nonce, now });
return true;
}
void p2pool::submit_aux_block() const
{
std::vector<SubmitAuxBlockData> submit_data;
@@ -972,24 +1041,29 @@ void p2pool::submit_aux_block() const
}
if (chain_id == chain_params.aux_id) {
IMergeMiningClient::ChainParameters submit_chain_params = submit_data[i].chain_params;
if (submit_chain_params.aux_id.empty() || submit_chain_params.aux_hash.empty() || submit_chain_params.aux_blob.empty()) {
submit_chain_params = chain_params;
}
std::vector<hash> proof;
uint32_t path;
if (m_blockTemplate->get_aux_proof(template_id, extra_nonce, chain_params.aux_hash, proof, path)) {
if (m_blockTemplate->get_aux_proof(template_id, extra_nonce, submit_chain_params.aux_hash, proof, path)) {
if (pool_block_debug()) {
const MinerData data = miner_data();
const uint32_t n_aux_chains = static_cast<uint32_t>(data.aux_chains.size() + 1);
const uint32_t index = get_aux_slot(chain_params.aux_id, data.aux_nonce, n_aux_chains);
if (!verify_merkle_proof(chain_params.aux_hash, proof, index, n_aux_chains, merge_mining_root)) {
if (!verify_merkle_proof(submit_chain_params.aux_hash, proof, index, n_aux_chains, merge_mining_root)) {
LOGERR(0, "submit_aux_block: verify_merkle_proof (1) failed for chain_id " << chain_id);
}
if (!verify_merkle_proof(chain_params.aux_hash, proof, path, merge_mining_root)) {
if (!verify_merkle_proof(submit_chain_params.aux_hash, proof, path, merge_mining_root)) {
LOGERR(0, "submit_aux_block: verify_merkle_proof (2) failed for chain_id " << chain_id);
}
}
c->submit_solution(block_tpl->get_coinbase_merkle_proof(), hashing_blob, nonce_offset, seed_hash, blob, proof, path);
c->submit_solution(submit_chain_params, block_tpl->get_coinbase_merkle_proof(), hashing_blob, nonce_offset, seed_hash, blob, proof, path);
}
else {
LOGWARN(3, "submit_aux_block: failed to get merkle proof for chain_id " << chain_id);
@@ -1358,6 +1432,9 @@ void p2pool::download_block_headers4(uint64_t start_height, uint64_t current_hei
if (m_serversStarted.exchange(1) == 0) {
m_p2pServer = new P2PServer(this);
m_stratumServer = new StratumServer(this);
if (!m_params.m_nodejsPoolRpc.empty()) {
m_nodejsPoolRpc = new NodejsPoolRpc(this, m_params.m_nodejsPoolRpc);
}
#if defined(WITH_RANDOMX) && !defined(P2POOL_UNIT_TESTS)
if (m_params.m_minerThreads) {
start_mining(m_params.m_minerThreads);
@@ -2355,6 +2432,8 @@ int p2pool::run()
#endif
delete m_stratumServer;
delete m_p2pServer;
delete m_nodejsPoolRpc;
m_nodejsPoolRpc = nullptr;
LOGINFO(1, "stopped");
return 0;
+19
View File
@@ -30,6 +30,7 @@ class Mempool;
class SideChain;
class StratumServer;
class P2PServer;
class NodejsPoolRpc;
class Miner;
class ConsoleCommands;
class p2pool_api;
@@ -76,6 +77,7 @@ public:
StratumServer* stratum_server() const { return m_stratumServer; }
P2PServer* p2p_server() const { return m_p2pServer; }
NodejsPoolRpc* nodejs_pool_rpc() const { return m_nodejsPoolRpc; }
#if defined(WITH_RANDOMX) && !defined(P2POOL_UNIT_TESTS)
void print_miner_status();
@@ -94,6 +96,7 @@ public:
#endif
void update_aux_data(const hash& chain_id);
bool get_merge_mining_chain_params(const hash& chain_id, IMergeMiningClient::ChainParameters& out_params) const;
void submit_block_async(uint32_t template_id, uint32_t nonce, uint32_t extra_nonce);
void submit_block_async(std::vector<uint8_t>&& blob);
@@ -104,6 +107,7 @@ public:
uint32_t template_id = 0;
uint32_t nonce = 0;
uint32_t extra_nonce = 0;
IMergeMiningClient::ChainParameters chain_params;
};
void submit_aux_block_async(const std::vector<SubmitAuxBlockData>& aux_blocks);
@@ -155,6 +159,7 @@ private:
void submit_block() const;
void submit_aux_block() const;
bool remember_recent_aux_submit(const SubmitAuxBlockData& data) const;
std::atomic<bool> m_stopped;
@@ -225,6 +230,7 @@ private:
std::atomic<uint32_t> m_serversStarted{ 0 };
StratumServer* m_stratumServer = nullptr;
P2PServer* m_p2pServer = nullptr;
NodejsPoolRpc* m_nodejsPoolRpc = nullptr;
std::atomic<bool> m_startupFinished{ false };
@@ -251,6 +257,19 @@ private:
mutable uv_mutex_t m_submitAuxBlockDataLock;
mutable std::vector<SubmitAuxBlockData> m_submitAuxBlockData;
struct RecentAuxSubmit
{
hash chain_id;
hash aux_hash;
uint32_t template_id = 0;
uint32_t nonce = 0;
uint32_t extra_nonce = 0;
uint64_t timestamp = 0;
};
mutable uv_mutex_t m_recentAuxSubmitsLock;
mutable std::vector<RecentAuxSubmit> m_recentAuxSubmits;
uv_async_t m_submitBlockAsync;
uv_async_t m_submitAuxBlockAsync;
uv_async_t m_blockTemplateAsync;
+21
View File
@@ -273,6 +273,11 @@ bool Params::process_arg(const std::vector<std::string>& arg)
return true;
}
if ((arg[0] == "nodejs-pool-rpc") && has1(arg)) {
m_nodejsPoolRpc = arg[1];
return true;
}
if ((arg[0] == "stratum-ban-time") && has1(arg)) {
m_stratumBanTime = strtoull(arg[1].c_str(), nullptr, 10);
return true;
@@ -304,6 +309,22 @@ bool Params::process_arg(const std::vector<std::string>& arg)
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;
+3
View File
@@ -89,9 +89,12 @@ struct Params
std::string m_stratumAddresses;
std::string m_p2pAddresses;
std::string m_nodejsPoolRpc;
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;
+10
View File
@@ -137,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));
@@ -341,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
+3
View File
@@ -56,6 +56,9 @@ static constexpr uint64_t MAX_BLOCK_SIZE = 128 * 1024 - 5;
// 0.6 XMR
static constexpr uint64_t BASE_BLOCK_REWARD = 600000000000ULL;
// Because these values are stored in a 56 bit field
static constexpr uint64_t MAX_OUTPUT_VALUE = (1ULL << 56) - 1;
// 1000 years at 1 TH/s. It should be enough for any normal use.
static constexpr difficulty_type MAX_CUMULATIVE_DIFFICULTY{ 13019633956666736640ULL, 1710ULL };
+13 -4
View File
@@ -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);
@@ -100,7 +99,7 @@ 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
// 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;
@@ -120,7 +119,7 @@ int PoolBlock::deserialize(const uint8_t* data, size_t size, const SideChain& si
READ_VARINT(reward);
// TxOutput max value check
if (reward >= (1ULL << 56)) {
if (reward > MAX_OUTPUT_VALUE) {
return __LINE__;
}
@@ -162,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
@@ -380,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();
+18 -9
View File
@@ -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;
}
}
@@ -1246,8 +1247,15 @@ bool SideChain::split_reward(uint64_t reward, const std::vector<MinerShare>& sha
w += shares[i].m_weight;
const difficulty_type next_value = w * reward / total_weight;
rewards.emplace_back(next_value.lo - reward_given);
const uint64_t r = next_value.lo - reward_given;
reward_given = next_value.lo;
if (r > MAX_OUTPUT_VALUE) {
LOGERR(1, "Reward of " << log::XMRAmount(reward) << " is too big for the current split.");
return false;
}
rewards.emplace_back(r);
}
// Double check that we gave out the exact amount
@@ -1374,7 +1382,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
@@ -2211,8 +2219,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();
@@ -2220,7 +2228,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;
}
@@ -2228,18 +2236,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!");
@@ -2267,7 +2276,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
+30 -19
View File
@@ -40,6 +40,7 @@ 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 {
@@ -144,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);
@@ -166,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;
}
}
}
@@ -317,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)
{
uint32_t rpc_id;
do {
client->m_rpcId = static_cast<StratumServer*>(client->m_owner)->get_random32();
} while (!client->m_rpcId);
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) {
@@ -333,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\":";
@@ -342,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;
}
@@ -432,7 +445,7 @@ bool StratumServer::on_submit(StratumClient* client, uint32_t id, const char* jo
if (aux_data.difficulty.check_pow(resultHash)) {
const char* s = client->m_customUser;
LOGINFO(0, log::Green() << "client " << static_cast<char*>(client->m_addrString) << (*s ? " user " : "") << s << " found an aux block for chain_id " << aux_data.unique_id << ", diff " << aux_data.difficulty << ", submitting it");
aux_blocks.emplace_back(p2pool::SubmitAuxBlockData{ aux_data.unique_id, template_id, nonce, extra_nonce });
aux_blocks.emplace_back(p2pool::SubmitAuxBlockData{ aux_data.unique_id, template_id, nonce, extra_nonce, {} });
}
}
@@ -971,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;
@@ -1111,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;
@@ -1147,7 +1156,7 @@ 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;
@@ -1187,6 +1196,8 @@ 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);
}
}
+28
View File
@@ -950,6 +950,34 @@ void set_thread_name(const char* name)
#endif
}
void init_uv()
{
// Creates the default loop if it doesn't exist yet
uv_default_loop();
#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));
}
}
std::string to_onion_v3(const hash& pubkey)
{
static constexpr uint8_t prefix[] = ".onion checksum";
+2 -2
View File
@@ -35,7 +35,7 @@
namespace p2pool {
#define P2POOL_VERSION_MAJOR 4
#define P2POOL_VERSION_MINOR 14
#define P2POOL_VERSION_MINOR 15
#define P2POOL_VERSION_PATCH 0
constexpr uint32_t P2POOL_VERSION = (P2POOL_VERSION_MAJOR << 16) | (P2POOL_VERSION_MINOR << 8) | P2POOL_VERSION_PATCH;
@@ -361,7 +361,7 @@ struct Callback
template<typename T>
struct Derived : public Base
{
explicit FORCEINLINE Derived(T&& cb) : m_cb(std::move(cb)) {}
explicit FORCEINLINE Derived(T&& cb) : m_cb(std::forward<T>(cb)) {}
R operator()(Args... args) const override { return m_cb(args...); }
private:
+1
View File
@@ -233,5 +233,6 @@ void parallel_run(uv_loop_t* loop, T&& callback, bool wait = false)
}
void set_thread_name(const char* name);
void init_uv();
} // namespace p2pool
+1 -1
View File
@@ -271,7 +271,7 @@ TEST(block_template, submit_sidechain_block)
}
ASSERT_EQ(sidechain.difficulty(), 219467);
ASSERT_EQ(sidechain.blocksById().size(), 4491);
ASSERT_EQ(sidechain.blocksById().size(), 4493);
ASSERT_TRUE(sidechain.precalcFinished());
const PoolBlock* tip = sidechain.chainTip();